Effacer les filtres
Effacer les filtres

A little bit tricky 2d plots

1 vue (au cours des 30 derniers jours)
Joon Jeon
Joon Jeon le 11 Avr 2012
I have three (100*2) matrix. (saying A, B and C)
Each column must be graphed against 1:100.
1. Firstly, if I want to show those 6 columns in one plot, how to do it? My try was
plot(A,B,C)
plot(1:100, A, 1:100, B, 1:100, C)
Both don't work.
2. Secondly, I have two indices for horizontal axis. It is e.g.
X1=1:1:100;X2=100:-1:1
For Vector A and B, X1 should be the versus. And for Vector C, X2 should be the versus.
Since I want all the vectors in the same plot, I want to use both X1 and X2 at the same time. Like.. making two index layers in the horizontal. Is it possible?
3. When I just plot X2 versus any vector, since X2 is decreasing, the order of data in vector changes in the plot. In the horizonal, X2 starts from 1 and vector gives the last value (100,:) first. How can I reverse it back?
4. Also, I want to give some name on xtick. Since X1 and X2 mean some kind of intensity degree in my data. I want to name it such as Strong, Even, Weak from 1 to 100. How should be it set?
Thanks.

Réponses (1)

Honglei Chen
Honglei Chen le 11 Avr 2012
1.
plot([A B C]);
2.
plotyy(X1,[A B],X2,C);
but because MATLAB always do the x axis from smallest to largest, your X1 and X2 are essentially the same.
3. 4.
To reverse the plot, I think you need to do some trick. Like plotting the data backwards and then label your axes differently. This also related to modifying the ticks. The following page should be helpful for those tasks.

Catégories

En savoir plus sur 2-D and 3-D Plots 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