Plotting two matrixes in same plot
Mostra commenti meno recenti
I would like to make a good plot for plotting two matrixes, both 300x19.
A = 300x19
B= 300x19
I was thinking somthing like scatter(A, B), but this do not seem to work. Get the following error "X and Y must be vectors of the same length."
Plot(A, B) does not provide the inforamtion in a good way.
Thanks,
Ingrid
Risposte (2)
KALYAN ACHARJYA
il 11 Giu 2019
surf(A,B)
Star Strider
il 11 Giu 2019
I am not certain what result you want..
One option:
figure
plot(A)
hold on
plot(B)
hold off
If you want them oriented differently, transpose them:
figure
plot(A')
hold on
plot(B')
hold off
You can also use scatter in place of plot if that is what you want.
If you want to plot every row of ‘A’ against the corresponding row of ‘B’:
figure
hold all
for k = 1:size(A,1)
plot(A(k,:), B(k,:))
end
hold off
3 Commenti
Ingrid Elisaebeth Glestad
il 11 Giu 2019
Ingrid Elisaebeth Glestad
il 11 Giu 2019
Star Strider
il 11 Giu 2019
My pleasure!
Probably the best option would be something like this:
figure
hold all
for k = 1:size(A,1)
scatter(A(k,:), B(k,:), 'filled')
end
hold off
I am still not certain what you want, however. The problem is that most of the plot functions want more than one argument, so simply plotting a matrix is not straightforward. It is likely necessary to plot individual rows or columns against each other. That is similar to what plotmatrix does.
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!