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

Answered
I can't click on figures to interact with them and open new figures
You could also try disableDefaultInteractivity.

4 years ago | 1

Answered
I can't click on figures to interact with them and open new figures
if ~verLessThan('matlab','9.5') set(groot,'defaultFigureCreateFcn',@(fig, ~)addToolbarExplorationButtons(fig)); ...

4 years ago | 1

| accepted

Answered
How to do vector projection?
In 2D Euclidean space, to project a point P=[x,y] onto a straight line, you need (1) a point on the line P0=[x0,y0] (2) a di...

4 years ago | 0

| accepted

Answered
Double parameter optimisation using optimisation toolbox
In this is my xdata P1 and ydata P2? xdata, ydata are what you call experimtalX and experimentalY. The unknown parameters that ...

4 years ago | 0

| accepted

Answered
fmincon lower bound interval
You cannot specify a partially discrete constraint like "x(i)=0 or x(i)>=0.1" on your variables with fmincon. To handle that w...

4 years ago | 0

| accepted

Answered
finding nonzero values in 4 matrixes which have the same indices
b=(ozone70>0 & ozone80>0 & ozone90>0 & ozone2000>0); areas=Areas(b); o70= ozone70(b); weightedMean=dot(areas/sum(areas),o...

4 years ago | 0

Answered
How to save each resultant matrix from a for loop
One way no_nodes = 5; A = 8; E = 1.9e6; L = 36; k = A*E/L; th = [0,pi/4,pi/2,3/4*pi]; K=cell(1,4); for i = 1:4 ...

4 years ago | 0

| accepted

Answered
Image detect and convert white image
A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png'); imshow(any(250-A,3))

4 years ago | 0

Answered
fmincon does not produce similar result due to automatic scaling?
With such a general description, only general things can be said. However, here are some remarks: What's more, what I tried is ...

4 years ago | 0

| accepted

Answered
Optimizer (fminsearch) doesn't work as expected
It appears that you have 21 unknown variables. That is too many. fminsearch is only guaranteed to converge theoretically for one...

4 years ago | 1

| accepted

Answered
Vector as an input in function
That should have worked. func([1,2]) function func(v) a=v(1), b=v(2), end

4 years ago | 0

| accepted

Answered
How to find the eigenvector associated with the highest eigenvalues.
No, the output of eig() is not sorted, but the output of svd() is.

4 years ago | 1

| accepted

Answered
Create and lock a struct with fields in a class
One way: classdef myclass properties x = struct('a',0,'b',1); end methods function obj...

4 years ago | 0

Load more