How can I plot 2D plot from three matrix?

2 views (last 30 days)
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

Accepted Answer

dpb
dpb on 20 Feb 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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!