This code is in response to the i just posted

2 次查看(过去 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
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