Answered
how to fix this error
p=[a b c d]; vector length 4 r=roots(p); roots() returns a *column vector* of length one less than the ...

3 years ago | 0

Answered
Why did I get this error in my code "Array indices must be positive integers or logical values"?
qdot(2)=1/M*(-(C+(1/2)*rho*cd*D*U1(j)*Lo)*q(2)-K*q(1)-Theta1*q(5)+((1/4)*rho*clo*D*U1(j).^2*Lo)*q(3)); j is not defined in ...

3 years ago | 0

Answered
How do I avoid the error : " assign output variable x0 for example has not been assigned a value" ?
If you are looking at function sf_bioc then it only assigns a value to x0 in the case that flag == 0. Code generation needs ther...

3 years ago | 0

Answered
How to add multiple legends in a loop for mulitple plots?
for r=1:3 figure; px= vardata(:,250, r); plot(px,'-', 'color',rand(1,3), 'DisplayName', "pixel " + r); legend sh...

3 years ago | 1

| accepted

Answered
Changing Values in a while loop
if i==2 k=5000; z=0.2; %Changing k and z for 9 cases elseif i==3 k=5000; z=0.4; The scope of the statements expect...

3 years ago | 0

Answered
Convert <undefined> to NaN or leave blank
Mo=readtable('MW_samples_Mathworks.csv', 'HeaderLines', 3);

3 years ago | 0

| accepted

Answered
How to add "maximum velocity" to aircraft GUI simulation in MATLAB?
elseif strcmp(key, 'p') vel = min(1500, vel * 1.05); I notice you have not tried to implement any kind of stall speed when...

3 years ago | 1

| accepted

Answered
How to solve this?
t=linspace(0,22200); ts=t*tstep t is a vector and tstep is scalar (we assume) so ts will be a vector. dC(:,:)=X+(u*X*ts)-(d1*...

3 years ago | 1

Answered
Performance of MATLAB with MacBook with M1 or M2 chips
Yes. See https://www.mathworks.com/matlabcentral/answers/641925-is-matlab-supported-on-apple-silicon-macs#answer_1097633 Note ...

3 years ago | 2

Answered
遗传算法个体是曲线,该如何处理
You cannot do that directly. However, if the valid curves are all members of a single family of curves, and members of the fami...

3 years ago | 0

| accepted

Answered
Is it possible to find the limit as a function approaches a complex number?
The MATLAB limit function calculates the limit from below and the limit from above, and tells you the limit is undefined if the ...

3 years ago | 0

| accepted

Answered
how can I do subtraction between two symbolic functions with different arguments?
You cannot. The symbolic function feature is specifically designed to prevent operations between symbolic functions that have di...

3 years ago | 0

Answered
What are the obs values in this spherical surface equation?
obs is the center of the sphere. sphere() returns coordinates for a unit sphere. You then scale them by the radius of the sp...

3 years ago | 1

Answered
Why scaleruler and northarrow functions cannot be used in mapshow figures
When there is no existing axes then mapshow creates a standard numeric axes. mapshow is for displaying maps without projection, ...

3 years ago | 0

Answered
Help with Legend for Plot
errarbar(t1,y7T1,err4) That should be errorbar() not errarbar() legend('CuSO4-0.625%', 'CuSO4-1.25%', 'CuSO4-2.5%', 'CuSO4-5%'...

3 years ago | 0

Answered
Taxi datset - lat lon colocation
Instead, do a rangesearch which is a knnsearch by distance. Either do a custom distance calculation of Great Circle Distance, o...

3 years ago | 0

Answered
EASY QUESTION ABOUT THE lsqlin COMMAND: Is it possible to use the lsqlin algorithm for MIMO systems (always with linear constraints)?
If you have two systems, A1, A2, B1, B2, and want to match A1*x1 = B1 and A2*x2 == B2 for independent sets x1 and x2, then you c...

3 years ago | 1

| accepted

Answered
regexp: match the entire expression
setStrings{1} = '2*x + 3'; setStrings{2} = '2*x'; first_kind = regexp(setStrings, '^\s*(?<A>-?\d+)\s*\*\s*x\s*$', 'names') ...

3 years ago | 0

| accepted

Answered
How to record input character by character (when people are typing)
No, not in MATLAB directly. The processing of keyboard input is up to the keyboard driver. MATLAB itself does not have any way t...

3 years ago | 0

Answered
Why can't I put unassigned variables in a 2 x 1 matrix?
In MATLAB, at each point in order to use a variable, it must be assigned something at the time it is used. Any variable that is ...

3 years ago | 1

Answered
solving 3 nonlinear equations including max function
Those equations need to be understood as defining the same function recursively. You should not be treating and and as being ...

3 years ago | 0

Answered
solving 3 nonlinear equations including max function
max() has a discontinuous derivative, and so is mathematically unsuited for use with fsolve() fsolve() relies upon the gradient...

3 years ago | 0

Answered
How can I make a contour plot?
[x, y] = meshgrid(-5:5, -5:5); z = x.^2 + 10.*y.^2 - 3.*x.*y; contour(x, y, z)

3 years ago | 1

| accepted

Answered
Help with workspace data extraction shortcut
y = X.output.name.(param)(:,end)

3 years ago | 0

| accepted

Answered
Find the set of eigenvectors of a 4x4 matrix elements whose matrix elements have some VARIABLE PARAMETERS.
I showed you in https://www.mathworks.com/matlabcentral/answers/1848378-how-to-read-the-eigenvectors-of-a-4x4-matrix-elements-fo...

3 years ago | 1

Answered
Is there a way to convert simscape blocks to a simple Matlab code?
sorry, No. You could use Simulink Coder to convert it to C or C++ but not to matlab.

3 years ago | 0

Answered
How to apply time varying input with dlode45?
X = dlode45(@odeModel,tspan,X0,neuralOdeParameters,DataFormat="CB"); remove the @ there. odeModel is already a function han...

3 years ago | 0

| accepted

Answered
How i can find ( ZT,N1,N2) N1,N2>=0
syms N1 N2 ZT = 130*N1+100*N2 constraint = 66*N1+84*N2==3000 N2sol = solve(constraint, N2) newNT = subs(ZT, N2, N2sol) opti...

3 years ago | 0

Answered
meaning of sys=@(k, xkm1, uk) xkm1/2 + 25*xkm1/(1+xkm1^2) + 8*cos(1.2*k) + uk;
In order to understand what MATLAB will calculate for that, then it is important to know that in your code at https://www.mathwo...

3 years ago | 1

Answered
How to read the eigenvectors of a 4x4 matrix elements for a given range of variable elements B and N.
You should learn a common programming pattern. Replace for B = 0:0.001:10 with Bvals = 0:0.001:10; numB = length(Bvals); ...

3 years ago | 1

Load more