How do I plot the minimum and maximum temperatures for each depth? i.e. the min and max boundaries of this graph?

15 views (last 30 days)
I want to plot the minimum and maximum temperatures (i.e. the min and max boundaries of this graph).
I have tried using findpeaks, but have not had success.
%settings
conductivity=.0033; %W m-1 K-1
heat_capacity=671.8; %J kg-1K-1
density=1300; %kgm-1^3
diffusivity=conductivity/(heat_capacity*density);
synodic_period=2.55e6; %seconds
synodic_frequency=(2*pi)/synodic_period;
T_av=250; %K
T_amp=150; %K
skin_depth=sqrt(2*diffusivity/synodic_frequency);
phase_dif=z*sqrt(synodic_frequency/(2*diffusivity));
t_list=linspace(0,synodic_period,25); %time frame over day (S_P)
z_list=linspace(0,.5,1000); %depth, starts at 0 goes to 1, 1000 steps
T=nan(length(t_list),length(z_list)); %output vector
for t_index=1:length(t_list)
t=t_list(t_index); %first timestep
for z_index=1:length(z_list)
z=z_list(z_index);
T(t_index,z_index)=T_av+T_amp*exp(-z*sqrt(synodic_frequency/(2*diffusivity)))*cos(synodic_frequency*t-z*sqrt(synodic_frequency/(2*diffusivity)));
end
end
plot(rot90(T), z_list)

Answers (1)

jonas
jonas on 6 Aug 2018
Edited: jonas on 6 Aug 2018
Assuming you have n series of T(d), each with data on m depths, just concatenate all your data in a m x n matrix and plot the max and min along n. For example:
%%10 series of data, 100 pts each
y=rand(100,10);
%%plot data
figure;hold on
plot(y)
%%plot max/min
plot(max(y,[],2),'linewidth',3)
plot(min(y,[],2),'linewidth',3)
  3 Comments

Sign in to comment.

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!