How to plot 2 functions into one plot
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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)
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]')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

