Demo entry 6763483

1

   

Submitted by anonymous on Oct 23, 2018 at 08:05
Language: Matlab. Code size: 1.7 kB.

%数值解与理论解的比较
%数值解dert=0.001s,derx=0.001m
%Fod>0.2时,时间大于16.2495s。
tx=[20,40,60,80,100,200,300,400,500];
ti=tx/tstep+1;
x=-xstep*(x_num-1):xstep:xstep*(x_num-1);
plot(x,T_re(ti(1),:),'--b');hold on;
plot(x,T_re(ti(2),:),'--g');hold on;
plot(x,T_re(ti(3),:),'--r');hold on;
plot(x,T_re(ti(4),:),'--c');hold on;
plot(x,T_re(ti(5),:),'--m');hold on;
plot(x,T_re(ti(6),:),'--y');hold on;
plot(x,T_re(ti(7),:),'--k');hold on;
plot(x,T_re(ti(8),:),'--b');hold on;
plot(x,T_re(ti(9),:),'--g');hold on;
legend('20s','40s','60s','80s','100s','200s','300s','400s','500s');

%thick为特征长度的毕渥数
Bid=h*thick/h_TC;
%求特征根u1
y=inline('x*tan(x)-0.7500','x');
[u1,yt]=fzero(y,0.1,[]);
xx=0:0.001:thick;

%求理论解的温度分布
T_the=zeros(length(tx),length(xx));
for i=1:length(tx)
    for j=1:length(xx)
        T_the(i,j)=2*sin(u1)/(u1+sin(u1)*cos(u1))*exp(-(u1^2)*a*(tx(i)/(thick*thick)))*cos(u1*xx(j)/thick);
    end
end

%还原为对称温度场
T_there=zeros(length(tx),2*length(xx)-1);
for i=1:length(tx)
    for j=1:length(xx)-1
        T_there(i,j)=T_the(i,length(xx)-j+1);
    end
    T_there(i,length(xx):2*length(xx)-1)=T_the(i,:);
end
T_there=T_there*100;
xxx=-0.03:0.001:0.03;
plot(xxx,T_there(1,:),'b');hold on;
plot(xxx,T_there(2,:),'g');hold on;
plot(xxx,T_there(3,:),'r');hold on;
plot(xxx,T_there(4,:),'c');hold on;
plot(xxx,T_there(5,:),'m');hold on;
plot(xxx,T_there(6,:),'y');hold on;
plot(xxx,T_there(7,:),'k');hold on;
plot(xxx,T_there(8,:),'b');hold on;
plot(xxx,T_there(9,:),'g');hold on;
legend('20s','40s','60s','80s','100s','200s','300s','400s','500s');
xlabel('x坐标/m');ylabel('温度/摄氏度');
grid on;
title('取固定时间点的温度分布曲线族与理论解的比较');
text(-0.025,95,'--:数值解');
text(-0.025,90,'—:分析解');

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).