How to plot 2 functions into one plot

6 Ansichten (letzte 30 Tage)
Mason Condren
Mason Condren am 16 Feb. 2023
Bearbeitet: Torsten am 16 Feb. 2023
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 Kommentar
Torsten
Torsten am 16 Feb. 2023
Bearbeitet: Torsten am 16 Feb. 2023
Why do you solve eqn for D if you nowhere use the result D_opt ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 16 Feb. 2023
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]')

Weitere Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by