How can I plot 2D plot from three matrix?

1 vue (au cours des 30 derniers jours)
Zubair Nizamani
Zubair Nizamani le 20 Fév 2017
Réponse apportée : dpb le 20 Fév 2017
I am trying to plot a 2D plot using three matrices but somehow I couldn't understand. I have three matrices and an array. Suppose,
A =
1 2 3
4 5 4
7 8 9
B =
2 3 13
5 11 10
9 7 6
C =
1 2 3
2 3 13
5 11 10
and an array
Y= [0.001 0.0002 0.0004].
Now I want to plot it in such a way that array values should be on y axis while against 0.001, 0.002 and 0.0004, the matrices value should be arranged. for examples, the
y=0.001, A(1,1)=1,
y=0.0002, B(1,1)=2
y=0.0004, C(1,1)=1
for a single line now similarly same process should go for A(i,j),B(i,j) and c(i,j) points using loop to plot all lines on a single figure.
Thanks

Réponse acceptée

dpb
dpb le 20 Fév 2017
M=cat(3,A,B,C); % build 3D array of all of individuals to manipulate as one
M=reshape(permute(M,[3,2,1]),3,[]); % rearrange by plane first, row & column and put in columns
plot(y,M) % plot each column against the y vector

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by