《MATLAB编辑一维热传导方程的模拟程序(最新整理)》由会员分享,可在线阅读,更多相关《MATLAB编辑一维热传导方程的模拟程序(最新整理)(4页珍藏版)》请在人人文库网上搜索。
1、求解下列热传导问题:2T - 1 T =( )z 2a t00zLT(z,0) = 1 - z 2T (0, t ) = 1,T (L, t ) = 0L = 1,a= 1程序:function heat_conduction() %一维齐次热传导方程options=空间杆长L,空间点数N ,时间点数M,扩散系数alfa,稳定条件的值lambda(取值必须小于0.5),;topic=seting; lines=1;def=1,100,1000,1,0.5;h=inputdlg(options,topic,lines,def); L=eval(h1);N=eval(h2);M=eval(h3);。
2、alfa=eval(h4); lambda=eval(h5);%lambda的值必须小于0.5%* h=L/N;%空间步长z=0:h:L;z=z;tao=lambda*h2/alfa;%时间步长tm=M*tao;%热传导的总时间tm t=0:tao:tm;t=t;%计算初值和边值T=zeros(N+1,M+1);Ti=init_fun(z);To=border_funo(t);Te=border_fune(t);T(:,1)=Ti;T(1,:)=To;T(N+1,:)=Te;%用差分法求出温度T与杆长L、时间t的关系for k=1:Mm=2;while m=NT(m,k+1)=lambda*(。
3、T(m+1,k)+T(m-1,k)+(-2*lambda+1)*T(m,k); m=m+1;end;end;%设置立体网格for i=1:M+1X(:,i)=z;end;for j=1:N+1Y(j,:)=t;end mesh(X,Y,T);view(1 -1 1);xlabel(Z);ylabel(t);zlabel(T);function y=init_fun(z)%初值条件y=1-z.2;returnfunction y=border_funo(t)%z=0的边界条件y=1+t.*0;returnfunction y=border_fune(t)%z=L的边界条件y=t*.0;retur。
4、n运行情况:按“run”运行时,弹出窗口将图中相关数据更改为:点击图框中的“OK”,在“command window”中输出结果为:“”“”At the end, Xiao Bian gives you a passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand th。
5、e importance of continuous learning, life is diligent, nothing can be gained, only continuous learning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you。