1 view (last 30 days)

clc;clf;clear;

A = zeros(2,2);

c = 0:0.1:2.23;

for x=(4-c)./(6+c)

y=10./(6+c);

A =[-1-2.*x(c)+y(c) x(c);-6.*y(c) 4-2.*c.*y(c)-6.*x(c)];

end

I am trying to plot a graph of trace-determinant of mmatrix A, where I am in need of the values of x and y varying with c in my matrix A.

The result is a vector of 0's, Values of y and care displayed fine but only one value of x in one iteration of c.

Array indices must be positive integers or

logical values.

Error in Untitled7 (line 8)

A =[-1-2.*x(c)+y(c) x(c);-6.*y(c)

4-2.*c.*y(c)-6.*x(c)];

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/514161-help-with-non-working-for-loop-for-generating-a-matrix#comment_818328

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/514161-help-with-non-working-for-loop-for-generating-a-matrix#comment_818328

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/514161-help-with-non-working-for-loop-for-generating-a-matrix#comment_818465

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/514161-help-with-non-working-for-loop-for-generating-a-matrix#comment_818465

Sign in to comment.