Trying to make a pcolor plot of a frequency table. Matrix dimensions don't agree!
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Sean de Wolski
2013-3-29
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!