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 日

0 投票

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 件のコメント

Hoi Tsim
Hoi Tsim 2015 年 10 月 14 日
thanks a lot for your answer. Helped very much!
Star Strider
Star Strider 2015 年 10 月 14 日
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 2015 年 10 月 16 日
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 2015 年 10 月 16 日
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.
Star Strider
Star Strider 2015 年 10 月 16 日
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 2015 年 10 月 16 日
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 2015 年 10 月 16 日
thanks very much for having a look!
Star Strider
Star Strider 2015 年 10 月 16 日
My pleasure!
Hoi Tsim
Hoi Tsim 2015 年 10 月 17 日
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 2015 年 10 月 17 日
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 日

0 投票

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 件のコメント

Hoi Tsim
Hoi Tsim 2015 年 10 月 14 日
thanks very much for your answer! loads of help

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2015 年 10 月 14 日

コメント済み:

2015 年 10 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by