This code is in response to the i just posted
2 views (last 30 days)
Show older comments
%%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 Comments
dpb
on 6 May 2018
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...
Answers (1)
Star Strider
on 6 May 2018
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 Comments
Star Strider
on 6 May 2018
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.
See Also
Categories
Find more on Variables 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!