Trying to make a pcolor plot of a frequency table. Matrix dimensions don't agree!
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have created a frequency table in matlab, with wave heights across the top and their direction down the side. The table has been created by sorting the data into intervals.
For example, the first column of the table contains waves between 0-1m high, the second column contains waves 1-2m, and so on and so forth up to 10m.
The first row contains waves with a direction of 0-30 degrees, the second row contains waves with a direction 30-60 degrees, and so on and so forth up to 360 degrees.
I am trying to do a pcolor plot of the frequency table but I am getting the matrix dimensions error. The thing is, I know why. I am using the pcolor(X,Y,C) command and whilst the frequency table contains 10 columns and 12 rows, my X and Y contain 1 more column and row respectively. This is because the data I am trying to plot lies between the interval boundaries so there will always be one more boundary than there are intervals.
Any tips on how to get around this? I feel like it should be a simple fix but alas :/
Thanks
0 commentaires
Réponses (2)
Sean de Wolski
le 29 Mar 2013
Two options I see:
1) Remove the first or last row/column. It sounds like this isn't ideal for you.
2) Use interp1() to interpolate the midpoint between each set of values (this will give you matrices of size n-1). Then use these.
0 commentaires
Voir également
Catégories
En savoir plus sur Contour 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!