This code is in response to the i just posted

조회 수: 1 (최근 30일)
Thashen  Naidoo
Thashen Naidoo 2018년 5월 6일
편집: Walter Roberson 2018년 5월 8일
%%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
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...
Thashen  Naidoo
Thashen Naidoo 2018년 5월 6일
ok Thanks, I added the image of the Question. Im not sure how to specify all the variables and then change the variables to give a certain output. The desired result is to get a graph that indicates all the trends asked for in the question Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
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
Thashen  Naidoo
Thashen Naidoo 2018년 5월 6일
Thank you so much, that plot will only work for the standard model, 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 Thank you so much for your help
Star Strider
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by