How to plot 2 functions into one plot
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mason Condren
le 16 Fév 2023
Modifié(e) : Torsten
le 16 Fév 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 commentaire
Réponse acceptée
Sulaymon Eshkabilov
le 16 Fév 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)
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

