This code is in response to the i just posted

1 vue (au cours des 30 derniers jours)
Thashen  Naidoo
Thashen Naidoo le 6 Mai 2018
%%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 commentaires
dpb
dpb le 6 Mai 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...
Thashen  Naidoo
Thashen Naidoo le 6 Mai 2018
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

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 6 Mai 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 commentaires
Thashen  Naidoo
Thashen Naidoo le 6 Mai 2018
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 le 6 Mai 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Variables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by