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

3 ビュー (過去 30 日間)
L
L 2018 年 8 月 6 日
コメント済み: L 2018 年 8 月 6 日
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)
  1 件のコメント
Image Analyst
Image Analyst 2018 年 8 月 6 日
In this line, where you first use z, what is z?
phase_dif=z*sqrt(synodic_frequency/(2*diffusivity));
You have not defined z before you tried to use it.

サインインしてコメントする。

回答 (1 件)

jonas
jonas 2018 年 8 月 6 日
編集済み: jonas 2018 年 8 月 6 日
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 件のコメント
jonas
jonas 2018 年 8 月 6 日
編集済み: jonas 2018 年 8 月 6 日
That is basically the same but slower, especially when you don't preallocate your variables :)
L
L 2018 年 8 月 6 日
Oh, thank you! This is my first time using Matlab, so I appreciate the help!

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-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