Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
need help with if, else use
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hi
i want to clculate Cp for different temperatures, if it is in the limit Ts(j)<=750; then should claculate Cp as
Cp=0.459389e3+(0.927605*Ts(j))+(-0.892667e-2*Ts(j)^2)+(0.427170e-4*Ts(j)^3)+(-0.823237e-7*Ts(j)^4)+(0.617737e-10*Ts(j)^5)+(-0.885174e-14*Ts(j)^6);
and if it is between 750 and 900 ie. Ts(j)>=750; Ts(j)<=900; then should claculate Cp as
Cp=0.960497e4+(0.311055e2*Ts(j))+(-0.821919e-1*Ts(j)^2)+(-0.9966420e-5*Ts(j)^3)+(-0.291067e-8*Ts(j)^4)+(0.166675e-9*Ts(j)^5)+(-0.112167e-12*Ts(j)^6);
and finaly if Ts(j)>=900; then should claculate Cp as
Cp=0.595783e3+(0.809290*Ts(j))+(-0.172302e-2*Ts(j)^2)+(0.113957e-5*Ts(j)^3)+(-0.946037e-10*Ts(j)^4)+(-0.762604e-13*Ts(j)^5);
% For conductivity "k" at different temp ranges;
if Ts(j)<=800;% c
k=0.519059e2+(-0.369417e-3*Ts(j))+(-0.768098e-4*Ts(j)^2)+(-0.811310e-8*Ts(j)^3)+(0.212134e-9*Ts(j)^4)+(-0.180744e-12*Ts(j)^5);
if Ts(j)>=800; % c
k=0.302492e2+(-0.155686e-1*Ts(j))+(0.144759e-4*Ts(j)^2)+(-0.982726e-8*Ts(j)^3)+(0.159948e-10*Ts(j)^4)+(-0.96461e-14*Ts(j)^5)+(0.148732e-17*Ts(j)^6);
and then i want to clculate M=...... below
roL=7800; % density of load mild steel kg/m3.
dx=1:25;
dt=0:5:60;
M=(roL*Cp*dx^2)/(k*dt);
please can somebody help me writing this in matlab.
thanks
0 Kommentare
Antworten (2)
Florin Neacsu
am 14 Okt. 2011
Something like:
if Ts(j)<=750
Cp=0.459389e3+(0.927605*Ts(j))+(-0.892667e-2*Ts(j)^2)+(0.427170e-4*Ts(j)^3)+(-0.823237e-7*Ts(j)^4)+(0.617737e-10*Ts(j)^5)+(-0.885174e-14*Ts(j)^6);
elseif Ts(j)<=900
Cp=0.960497e4+(0.311055e2*Ts(j))+(-0.821919e-1*Ts(j)^2)+(-0.9966420e-5*Ts(j)^3)+(-0.291067e-8*Ts(j)^4)+(0.166675e-9*Ts(j)^5)+(-0.112167e-12*Ts(j)^6);
else Ts(j)>900
Cp=0.595783e3+(0.809290*Ts(j))+(-0.172302e-2*Ts(j)^2)+(0.113957e-5*Ts(j)^3)+(-0.946037e-10*Ts(j)^4)+(-0.762604e-13*Ts(j)^5)
end
To make it clear
if T<=750
Cp=...
elseif T<=900
Cp=...
else
Cp=...
end
Btw, you need to choose the exact Cp for T=900 (right now you have 2 different definitions).
Regards, Florin
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!