This code is in response to the i just posted
조회 수: 1 (최근 30일)
이전 댓글 표시
%%standard model conditions
K = 2.5;%Wm^-1 C^-1
A = 1.25; %uWm^-3
Q = 21*(10^-3); %Wm^-2
d = 50; % km
%%conditions for depth
z = [0:2:50]; %%stop at 50
z; % km
%%conditions for temperature
T = [0:500:2500]; %%stop at 2500
T; % units to be in degrees celsius
function T = (-A*z^2)/(2K) + ((Q + A*d)/K)*(z);
댓글 수: 2
dpb
2018년 5월 6일
We don't know what that was w/o looking it up...either edit the original question or add as a comment to it; do NOT start a totally new thread that is meaningless on its own...
답변 (1개)
Star Strider
2018년 5월 6일
This will get you started:
%%standard model conditions
K = 2.5;%Wm^-1 C^-1
A = 1.25; %uWm^-3
Q = 21E-3; %Wm^-2
d = 50; % km
%%conditions for depth
z = [0:2:50]; %%stop at 50 z; km
%%conditions for temperature
% T = [0:500:2500]; %%stop at 2500 T; units to be in degrees celsius
T = (-A*z.^2)/(2*K) + ((Q + A*d)/K)*(z);
plot(T, z)
set(gca, 'YDir','reverse')
I leave the rest to you.
댓글 수: 2
Star Strider
2018년 5월 6일
My pleasure.
This is a homework problem, so we give only limited help and suggestions to get you started.
‘How do create a code that will allow me to vary the parameters as in the question and then plot all on the same graph’
There are several options. I would do a separate calculation for each of (a), (b), and (c), since you are varying different parameters in each one.
For (d) and (e), you can use a for (link) loop to loop through them, since you are varying the same parameter. You first need to create a (1x2) vector for the ‘basal heat flow’ values. Also see the documentation on Matrix Indexing (link) to understand how to create one matrix for the results in (d) and (e).
I leave the rest to you.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!