plot of a cell array

HELLO there.
I want to get the plot of a cell but it appears to be empty plot could someone help me?

7 Comments

DGM
DGM on 24 Apr 2021
It might help if you posted the code you were trying to use. I'm not very good at guessing, and your screen is too far away for me to read.
i have a 1*121 cell arrays each one has two components for example [1,2] and i just want the first one i mean 1
here is my code
for n = 1:121
T1=[B(n) C(n);D(n) H(n)]
T2=[R(n) G(n);E(n) L(n)]
T{n}=T1*inv(T2);
ei{n}=eig(T1*inv(T2));
You do not show us any attempt to plot.
Have you confirmed that you are not getting infinity or nan from your inv() ?
Why are you calculating T1*inv(T2) and assigning it to a variable, and then immediately calculating it again on the next line to take the eig of it?
Is there a good reason you are using T1*inv(T2) instead of using T1/T2 ?
here T1 is something different from T2. they have different values.
i want T to be T1*inv(T2), coz my method define my code then next line i want eigen value of every square matrix
You have
T{n}=T1*inv(T2);
That is T1 on the left, and inv(T2) on the right.
On the next line you have
ei{n}=eig(T1*inv(T2));
Inside the eig() you have T1*inv(T2) which is T1 on the left and T2 on the right, exactly the same as on the line above. Why did you not code
ei{n} = eig(T{n});
??
And why did you use
T1*inv(T2)
instead of
T1/T2
?? Why are you using the less-accurate method of making that calculation? Do you have a special reason for deliberately reducing the accuracy of the calculation compared to T1/T2 ?
... And you still have not said anything about how you are doing the plotting, and whether you have confirmed that your results are finite.
Nara Lee
Nara Lee on 25 Apr 2021
Edited: Nara Lee on 25 Apr 2021
actually there is no difference between T1/T2 or T1*invT2 and no diff between ei{n}=eig(T{n}) and what i just wrote i really checked it.
and now i want plot from a cell
g{n}=log(ei{n})
im{n}=imag(g{n})
plot(im)
I know it would give me the plot but as i said i want just the first components of each cell be plotted.
there is a 1*121 cell that each cell has for example [2.34,0.3456]
im is a cell array that contains columns vectors of eigenvalues. What should the plot look like?

Sign in to comment.

Answers (1)

Nara Lee
Nara Lee on 25 Apr 2021
Edited: Nara Lee on 25 Apr 2021

0 votes

this is im{n} and actually it gives me wrong answer it shouldn't be like this and if I do it just for one frequency it gives me same wrong answer

Asked:

on 24 Apr 2021

Edited:

on 25 Apr 2021

Community Treasure Hunt

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

Start Hunting!