Only plot values until maximum is reached

3 Ansichten (letzte 30 Tage)
Andrew
Andrew am 18 Dez. 2014
Beantwortet: Star Strider am 18 Dez. 2014
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?

Antworten (1)

Star Strider
Star Strider am 18 Dez. 2014
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.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by