Answered
How to rotate a plotted square with analog input?
Easiest is to use polyshape, h1=nsidedpoly(4,'SideLength',5,'Center',[2,3]+2.5); h2=rotate(h1,30, [2,3]+2.5); plot([h1,h2])...

4 years ago | 0

Answered
Obtain the transposed matrix from 2 vectors (MATLAB)
You can do a pseudo-inversion with, c=[1 0 0 0 0 1 1 0 1 0 0 0]; s=[0 1 0 1 1 1]; HT=c\s; c*HT-s however, you have far mo...

4 years ago | 0

Answered
If I let A, B, and C be 2x2 matrices, is it possible for me to assign a label to each matrix element in matrix C where C = A*B?
The attached class might be what you are looking for, if all you want to do are the operations C=A*B. To understand what it's do...

4 years ago | 2

Answered
If A and B are 2x2 matrices, how is the input (A*B)^2 interpreted by MATLAB as?
It is interpreted as, tmp=A*B; C=tmp*tmp;

4 years ago | 1

Answered
Ellipse with a, b and angle between semi major axis and x-axis variable
Very straightforward if you download this, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools-for...

4 years ago | 0

Answered
Manipulating Cell arrays element
aa(ss==2)={[]};

4 years ago | 1

| accepted

Answered
Remove outliers in matlab 2018a
Perhaps as follows: A=repmat((1:5)',1,5); A(end-1)=100, tf=isoutlier(A(:,5)); A(tf,:)=[]

4 years ago | 0

| accepted

Answered
How can i calculate diameter of the red object ?
Assuming you don't care about camera perspective issues, why not with, regionprops(___,'EquivDiameter') Or, since you have alr...

4 years ago | 0

| accepted

Answered
If I let A, B, and C be 2x2 matrices, is it possible for me to assign a label to each matrix element in matrix C where C = A*B?
I'm talking about assigning a variable to each matrix element One way, A=rand(2); B=rand(2); C=A*B, tmp=num2cell(C); [c1...

4 years ago | 0

| accepted

Answered
Optimization with maximum number of "nonzero" x
Another approach is to reformulate problem in the form, min. norm(x,1) s.t. objective(x)<=C %and other constraints This does...

4 years ago | 0

Answered
Optimization with maximum number of "nonzero" x
To handle that with a continuous-domain optimizer like fmincon, you must run a separate fmincon optimization for every possible ...

4 years ago | 0

Answered
How to fill a gap between line segments in an image
load gap Irasterl=imclose(Irasterl,ones(3)); imshow(Irasterl,[])

4 years ago | 0

| accepted

Answered
Produce simple iradon geometry
data = [0,1,2,3,4,3,2,1,0]; theta=linspace(0,180,1000); theta(end)=[]; R1 = radon(data,theta); figure(2) N=numel(theta);...

4 years ago | 0

| accepted

Answered
because NaN or Inf function value encountered during search while using fzero
The problem occurs because func() has no axis crossing. aa=810930; bb=1216395; func = @(xt) 5e6-5e6*(exp(-aa*xt)-exp(-bb*xt))...

4 years ago | 0

| accepted

Answered
can someone explain the isa
Why not read their doc pages and the examples there? isa strcmpi string One thing that is strange in this code is that eq is...

4 years ago | 0

Answered
How to fit a function with two or more dependant variables (outputs)?
lsqcurvefit does not care about the dimensionality of the independent or dependant variables.

4 years ago | 0

| accepted

Answered
MatLab does not like my function. It says I need an 'end', but I have one.
Your if statement is closed by an end, but the function statement needs one as well, in certain circumstances. function drawbox...

4 years ago | 0

| accepted

Answered
How to identify each polyshape independently.
If you download spatialgraph2D, https://www.mathworks.com/matlabcentral/fileexchange/73630-spatialgraph2d?s_tid=ta_fx_results ...

4 years ago | 1

Answered
How to Find What Toolbox a Function is in From Documentation?
See the upper-left corner of the doc page. In this case, it is the Statistics and Machine Learning Toolbox.

4 years ago | 0

| accepted

Answered
How to find the optimal solution between boundary values?
The derivative of the curve is zero at x=sqrt(b/a). So, the condition is, 0<a, 0<b, sqrt(b/a)<d

4 years ago | 0

| accepted

Answered
fmincon solution different for different start values
While the output of the function (here LCOE) is really close, values at which the output ist produced differ. That means they ...

4 years ago | 0

| accepted

Answered
How to legend two curves in a single plot line, MATLAB R2022a App designer.
case 'Bode - Re & Phase vs Fq' yyaxis(app.UIAxes,'left'); app.UIAxes.XScale = 'log'; app.UIAxes.YDir ...

4 years ago | 0

Answered
Step function with variable number of steps
f=@(x) interp1(mesh,c,x,'previous');

4 years ago | 0

| accepted

Answered
Avoiding for loops for multiplication of multidimensional matrices
D=reshape(D,1,1,T,2); E=vecnorm(D-y,2,4).^2;

4 years ago | 0

| accepted

Answered
How do I apply the if else condition on vectors correctly in this case?
You don't use if...else to apply conditions element-wise. You use logical indexing: P_WT=zeros(length(IR),1,'gpuArray'); P_W...

4 years ago | 1

| accepted

Answered
Summation in function handle
J_A = @(x) sum(abs(Hpe-x(1).*exp(-1i.*omega.*x(2)).*(x(3).^2)./((1i.*omega.^2)+2.*x(3).*x(4).*1i.*omega+x(3).^2)).^2);

4 years ago | 0

| accepted

Answered
i have 81x2 matrix i want to convert into 9x9 matrix what should i do?
A=rand(81,2); B=reshape(A,[9,9,2]); whos A B

4 years ago | 0

Answered
Which Gaussian fitting tool should I use?
Personally, I'm a fan of this Gaussian fitting routine: https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn

4 years ago | 0

Answered
concatenate string with array
A= [23.5567, 5.34567, 23.1]; B= [-13.5357, 6.254, 2101.2]; C= [4,8,15]; formatSpec="%d-sample1-sample2-(%.2f, %.2f)"; str ...

4 years ago | 0

Load more