Only plot values until maximum is reached
조회 수: 2 (최근 30일)
이전 댓글 표시
This is my script to plot my radiosonde data:
% Temperature and Dew Point against Pressure
[row,col] = find(max(data(:,8))) maxh = max(data(:,8));
plot(sondedata(:,10),sondedata(:,9),'b-',sondedata(:,4),sondedata(:,9),'r-') set(gca,'YDir','reverse'); grid ylabel('P(mb)') xlabel('T(K)') title('Temperature (red) and Dew Point (blue) against Pressure');
Except I want the [row,col] section to plot values until the balloon reaches it's maximum height, and then plot no more. This doesn't work currently, what can I do?
댓글 수: 0
답변 (1개)
Star Strider
2014년 12월 18일
If you’re just finding the max in one column (column 8 in your code), you can just use the max function with two outputs:
[maxh,row] = max(data(:,8));
then if you only want to plot from 1 to ‘row’ (the index of your maximum height value), specify those indices in your plot call:
ixrng = 1:row;
plot(sondedata(ixrng,10),sondedata(ixrng,9),'b-',sondedata(ixrng,4),sondedata(ixrng,9),'r-')
I don’t have your data and I don’t know how ‘data’ relates to ‘sonedata’ so I’m just guessing here.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!