why doesn't this matlab code work? HELP!!!
古いコメントを表示
My problem is that this code doesn't work and I need the graph. Help please.
clear all
clc;
es=0.007;%m
d=2800;%kg/m^3
k=180;%W/m K
E=0.8;
C=900;%J/kg K
Tamb=298;%K
As=0.04;%m^2
qh=12500; %W/m^2 K
h=10;%W/m^2 K
Tfp=408;%K
cteEB=5.67*10^-8;
V=0.00028;%m^3
to=0;
deltat=0.1;% seconds
t=[];
Tf=[];
while (Tfp>=Tf)
Tf(i+1)=(As/(d*C*V))*(qh-(h*(Tf(i)-Tamb))-(E*cteEB*(Tf(i)^4-Tamb^4)))*deltat+Tf(i);
t(i+1)=t(i)+deltat;
hold on
plot(Tf,t);
i=i+1;
end
xlabel ('Temperature');
ylabel ('Time [s]');
2 件のコメント
John D'Errico
2021 年 3 月 6 日
PLease do not provide a PICTURE of your code. That makes it virtually impossible for someone to easily help you, because they need to then type in your code by reading the code and then transcribing it character by character into MATLAB. And why would you possibly want to make it more difficult to get help?
Erika Abril
2021 年 3 月 6 日
採用された回答
その他の回答 (1 件)
Basil C.
2021 年 3 月 6 日
The error could be in the while loop. Try using the following.
while(Tfp>=Tf(end))
If you could share the error, it would be more helpful
2 件のコメント
Walter Roberson
2021 年 3 月 6 日
Oddly enough in this particular loop testing the entire vector is not the problem, though testing an entire vector is often a problem.
Erika Abril
2021 年 3 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
