MATLAB Answers

Help with non working for loop for generating a matrix

2 views (last 30 days)
Jeff
Jeff on 30 Mar 2020
Edited: Jeff on 4 Jul 2020
jfjfj

  1 Comment

James Tursa
James Tursa on 31 Mar 2020
c is a vector, so what is x(c) supposed to mean?
Can you just post the equations you are trying to code and we can help you code them?

Sign in to comment.

Accepted Answer

Matt J
Matt J on 31 Mar 2020
Edited: Matt J on 31 Mar 2020
One approach is to write x,y, and A as matrix-valued anonymous functions of c, e.g.,
x=@(c)(4-c)./(6+c);
y=@(c)10./(6+c);
A = @(c) [-1-2.*x(c)+y(c) x(c);-6.*y(c) 4-2.*c.*y(c)-6.*x(c)];
fplot(@(c) trace(A(c)), [0,2.23])
xlabel 'c'
ylabel 'Trace(A(c))'

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!