Only plot values until maximum is reached

조회 수: 2 (최근 30일)
Andrew
Andrew 2014년 12월 18일
답변: Star Strider 2014년 12월 18일
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?

답변 (1개)

Star Strider
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.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by