How to plot 2 functions into one plot

6 ビュー (過去 30 日間)
Mason Condren
Mason Condren 2023 年 2 月 16 日
編集済み: Torsten 2023 年 2 月 16 日
Here below is my code, I am trying to get Q1 and Q2 to show up on the same plot while differentiating between the two. The graph should look like the one attached.
=============================================================================================================
% density
p = 1.009;
%dynamic visc
mew = 3.09e-5;
%width
w = 0.022;
%delta Pressure
delP = 31.1;
cp = 1008;
k = 0.02953;
Pr = 0.7154;
%kinematic visc
v = 2.097e-5;
%t optimal
t = 0.001011;
L = 0.022;
%L_opt
H = 0.022477;
%buoyancy
B = (1/350);
%alpha
a = 2.931e-5;
syms D;
eqn = (1/12)*(1/mew)*p^(4/3)*D^3*w^(-4/3)*delP^(2/3)*cp == 1.20818*k*Pr^(1/3)*v^(-2/3)*((D+t)/(L+t))^(1/3)*L^(1/3)
D_opt = vpasolve(eqn,D)
Q1 = ((L+t)/(D+t))*((p*B*9.81*w*cp*(134-20)^2*D^3)/(12*v));
Q2 = 1.034*k*w*(134-20)*((1/(a*v))*B*9.81*H^3*(134-20)^(1/4)*((L+t)/(D+t)));
fplot(Q1)
fplot(Q2)
=============================================================================================================
  1 件のコメント
Torsten
Torsten 2023 年 2 月 16 日
編集済み: Torsten 2023 年 2 月 16 日
Why do you solve eqn for D if you nowhere use the result D_opt ?

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

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 2 月 16 日
Here is a code that shows the plot figure similar to the assignment:
% density
p = 1.009;
%dynamic visc
mew = 3.09e-5;
%width
w = 0.022;
%delta Pressure
delP = 31.1;
cp = 1008;
k = 0.02953;
Pr = 0.7154;
%kinematic visc
v = 2.097e-5;
%t optimal
t = 0.001011;
L = 0.022;
%L_opt
H = 0.022477;
%buoyancy
B = (1/350);
%alpha
a = 2.931e-5;
syms D;
eqn = (1/12)*(1/mew)*p^(4/3)*D^3*w^(-4/3)*delP^(2/3)*cp == 1.20818*k*Pr^(1/3)*v^(-2/3)*((D+t)/(L+t))^(1/3)*L^(1/3)
eqn = 
D_opt = vpasolve(eqn,D);
Q1 = ((L+t)/(D+t))*((p*B*9.81*w*cp*(134-20)^2*D^3)/(12*v));
Q2 = 1.034*k*w*(134-20)*((1/(a*v))*B*9.81*H^3*(134-20)^(1/4)*((L+t)/(D+t)));
fplot(Q1, 'r-', 'linewidth', 2);
hold on
fplot(Q2, 'b-', 'linewidth', 2);
xlim([0 0.025]),
ylim([-50, 500]),shg
grid on
xlabel('D, [mm]')
ylabel('Heat Transfer, [W]')
  2 件のコメント
Mason Condren
Mason Condren 2023 年 2 月 16 日
Thank you!!
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 2 月 16 日
Most welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by