I'm struggling to plot this graph

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.

 采纳的回答

Star Strider
Star Strider 2015-10-14

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 个评论

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
thanks! I'm struggling because I'm doing a maths project but never used matlab and plotted these sorts of functions before.
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
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.)
thanks very much for having a look!
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)?
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!

请先登录,再进行评论。

更多回答(1 个)

Thorsten
Thorsten 2015-10-14
编辑:Thorsten 2015-10-14
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))

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by