I have this equation
with the variables
and i'm trying to get this plot
I keep getting a straight line.I'm not sure what I have done wrong.
Can anyone help me and copy and paste the input which is needed to form this plot.
thanks for the help in advance.

 Réponse acceptée

Star Strider
Star Strider le 14 Oct 2015

0 votes

This plots correctly for me:

aeq = @(T,Ts,dT,a) a(1) - 0.5*a(2).*(1 + tanh((T - Ts)./dT));
a = [0.58; 0.47];
Ts = 283;
dT = 24;
T = linspace(250, 310);
figure(1)
plot(T, aeq(T,Ts,dT,a))
hold on
plot(288, aeq(288,Ts,dT,a), '+r')
hold off

11 commentaires

Hoi Tsim
Hoi Tsim le 14 Oct 2015
thanks a lot for your answer. Helped very much!
My pleasure!
If you want to calculate the value of ‘T’ corresponding to aeq=0.3, use the fzero function:
Ta3 = fzero(@(T) aeq(T,Ts,dT,a)-0.3, 1)
Ta3 =
287.6532
Hoi Tsim
Hoi Tsim le 16 Oct 2015
thanks! I'm struggling because I'm doing a maths project but never used matlab and plotted these sorts of functions before.
Hoi Tsim
Hoi Tsim le 16 Oct 2015
I've also got another 2 graphs which include plotting 2 curves in the same graph and another really difficult one. Hopefully someone helps me.
My pleasure!
To plot 2 (or more) curves on the same plot, the easiest way is to use the hold function:
figure(1)
plot(x, y1)
hold on
plot(x, y2)
hold off
grid
Star Strider
Star Strider le 16 Oct 2015
I looked at those, but cannot figure out what Q is. you need to know what it is or how to calculate it before you can proceed. (Meteorology and Climatology are not areas of my expertise. I know what albedo is, but I am not familiar with those equations.)
Hoi Tsim
Hoi Tsim le 16 Oct 2015
thanks very much for having a look!
Star Strider
Star Strider le 16 Oct 2015
My pleasure!
Hoi Tsim
Hoi Tsim le 17 Oct 2015
i have looked at my notes and i see that σ = 5.670367 × 10-8 kg s-3 K-4
does this help with continuing the question?
do i just set it out like the first plot you helped me with, defining each equation and then after >> figure i type.. plot(T, aeq(T,Ts,dT,a),Ri,Ro)?
Star Strider
Star Strider le 17 Oct 2015
I still don’t know what Q is, or how to calculate it. (It seems to be a variable, and could be either data a function. It is necessary to calculate at least one other variable in your other two Questions, and in one is the essence of the Question.)
Sorry, but full stop until I get a definition for Q!

Connectez-vous pour commenter.

Plus de réponses (1)

Thorsten
Thorsten le 14 Oct 2015
Modifié(e) : Thorsten le 14 Oct 2015
a1 = 0.58;
a2 = 0.47;
Tstar = 283;
dT = 24;
aeq = @(T) a1 - 0.5*a2 *(1 + tanh((T-Tstar)/dT))
T = 250:310;
plot(T, aeq(T))

1 commentaire

Hoi Tsim
Hoi Tsim le 14 Oct 2015
thanks very much for your answer! loads of help

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by