Only plot values until maximum is reached

7 次查看(过去 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?

回答(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