Trying to make a pcolor plot of a frequency table. Matrix dimensions don't agree!
조회 수: 2 (최근 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에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!