How can I plot 2D plot from three matrix?

2 ビュー (過去 30 日間)
Zubair Nizamani
Zubair Nizamani 2017 年 2 月 20 日
回答済み: dpb 2017 年 2 月 20 日
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

採用された回答

dpb
dpb 2017 年 2 月 20 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by