Code not running/plotting
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Valerie
le 27 Oct 2023
Déplacé(e) : Dyuman Joshi
le 27 Oct 2023
% input parameters
Ta=15+273.15;
ha=5;
Tr=-7+273.15;
Tw=10+273.15;
Hi=10;
Bi=20;
Li=60;
Kins=0.045;
xbar=Li/Hi;
ybar=Bi/Hi;
er=0.05;
ep=0.95;
sigma=5.670e-8;
Tins=-5+273.15;
syms tins;
% define eqns
Aw1=Li*Bi;
Aw2=Hi*Bi;
Aw3=Li*Hi;
Awt=2*Aw3+2*Aw2
Rconv1=1/(ha*(2*Aw3+2*Aw2))
Rconv2=1/(ha*Aw1)
Rconv3=1/(ha*Aw1)
Rcond = tins/(Kins*Aw1)
F23=(2/(pi*xbar*ybar))*((log((((1+xbar^2)*(1+ybar^2))/(1+xbar^2+ybar^2))^0.5))+(xbar*(1+ybar^2)^(0.5))*atan((xbar)/((1+ybar^2)^0.5))+(ybar*(1+xbar^2)^0.5)*atan((ybar)/((1+xbar^2)^0.5))-xbar*atan(xbar)-ybar*atan(ybar));
Rrad2=1/(Aw1*F23)
F32=F23;
F31=1-F32;
Rrad3=1/(Aw1*F31)
F13=(Aw1*F31)/Awt
F12=1-F13
Rrad1=1/(Awt*F12)
Rrad4=(1-ep)/(ep*Aw3);
%CALCULATE NET q
syms Tc;
Eb3=sigma*Tc^4;
Eb1=sigma*Tw^4
Eb2=sigma*Tr^4;
Qrad=ep*Eb3*Aw1-ep*Eb1*Awt*F13-ep*Eb2*Aw1*F23;
Qconv=ha*Aw1*(Tc-Ta);
Qcond=(Tc-Tins)/(Rcond);
% Plotting T vs tins
Func = 0 == -Qconv -Qcond -Qrad;
Tc = solve(Func,Tc);
fplot(Tc,[0.1,1])
How can I plot this code?
0 commentaires
Réponse acceptée
Walter Roberson
le 27 Oct 2023
Déplacé(e) : Walter Roberson
le 27 Oct 2023
% input parameters
Ta=15+273.15;
ha=5;
Tr=-7+273.15;
Tw=10+273.15;
Hi=10;
Bi=20;
Li=60;
Kins=0.045;
xbar=Li/Hi;
ybar=Bi/Hi;
er=0.05;
ep=0.95;
sigma=5.670e-8;
Tins=-5+273.15;
syms tins;
% define eqns
Aw1=Li*Bi;
Aw2=Hi*Bi;
Aw3=Li*Hi;
Awt=2*Aw3+2*Aw2
Rconv1=1/(ha*(2*Aw3+2*Aw2))
Rconv2=1/(ha*Aw1)
Rconv3=1/(ha*Aw1)
Rcond = tins/(Kins*Aw1)
F23=(2/(pi*xbar*ybar))*((log((((1+xbar^2)*(1+ybar^2))/(1+xbar^2+ybar^2))^0.5))+(xbar*(1+ybar^2)^(0.5))*atan((xbar)/((1+ybar^2)^0.5))+(ybar*(1+xbar^2)^0.5)*atan((ybar)/((1+xbar^2)^0.5))-xbar*atan(xbar)-ybar*atan(ybar));
Rrad2=1/(Aw1*F23)
F32=F23;
F31=1-F32;
Rrad3=1/(Aw1*F31)
F13=(Aw1*F31)/Awt
F12=1-F13
Rrad1=1/(Awt*F12)
Rrad4=(1-ep)/(ep*Aw3);
%CALCULATE NET q
syms Tc;
Eb3=sigma*Tc^4;
Eb1=sigma*Tw^4
Eb2=sigma*Tr^4;
Qrad=ep*Eb3*Aw1-ep*Eb1*Awt*F13-ep*Eb2*Aw1*F23;
Qconv=ha*Aw1*(Tc-Ta);
Qcond=(Tc-Tins)/(Rcond);
% Plotting T vs tins
Func = 0 == -Qconv -Qcond -Qrad;
Tc = solve(Func,Tc, 'MaxDegree', 4);
tiledlayout('flow');
for K = 1 : 4;
TcfunR = matlabFunction(real(Tc(K)));
TcfunI = matlabFunction(imag(Tc(K)));
nexttile();
fplot({TcfunR, TcfunI}, [0.1, 1]); legend({'real', 'imag'}); title(string(K));
end
%fplot(Tc,[0.1,1])
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Formula Manipulation and Simplification 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!