![Matlab解热传导方程代码_第1页](http://file1.renrendoc.com/fileroot_temp2/2021-1/7/6533125e-e2b9-4fcc-9cbc-e4aa216b1e84/6533125e-e2b9-4fcc-9cbc-e4aa216b1e841.gif)
![Matlab解热传导方程代码_第2页](http://file1.renrendoc.com/fileroot_temp2/2021-1/7/6533125e-e2b9-4fcc-9cbc-e4aa216b1e84/6533125e-e2b9-4fcc-9cbc-e4aa216b1e842.gif)
![Matlab解热传导方程代码_第3页](http://file1.renrendoc.com/fileroot_temp2/2021-1/7/6533125e-e2b9-4fcc-9cbc-e4aa216b1e84/6533125e-e2b9-4fcc-9cbc-e4aa216b1e843.gif)
![Matlab解热传导方程代码_第4页](http://file1.renrendoc.com/fileroot_temp2/2021-1/7/6533125e-e2b9-4fcc-9cbc-e4aa216b1e84/6533125e-e2b9-4fcc-9cbc-e4aa216b1e844.gif)
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Sample MATLAB codes 1.%Newton Cooling Lawclear; close all; clc; h = 1;T(1) = 10; %T(0)error = 1;TOL = 1e-6;k = 0;dt = 1/10;while error TOL, k = k+1; T(k+1) = h*(1-T(k)*dt+T(k); error = abs(T(k+1)-T(k);endt = linspace(0,dt*(k+1),k+1); plot(t,T),hold on, plot(t,1,r-.)xlabel(Time),ylabel(Temperature),t
2、itle(T_0 = ,num2str(T(1), , T_infty = 1),legend(Cooling Trend,Steady State)2.%Boltzman Cooling Lawclear; close all; clc; h = 1;T(1) = 10; %T(0)error = 1;TOL = 1e-6;k = 0;dt = 1/10000;while error TOL, k = k+1; T(k+1) = h*(1-(T(k)4)*dt+T(k); error = abs(T(k+1)-T(k); endt = linspace(0,dt*(k+1),k+1); pl
3、ot(t,T),hold on, plot(t,1,r-.)xlabel(Time),ylabel(Temperature),title(T_0 = ,num2str(T(1), , T_infty = 1),legend(Cooling Trend,Steady State)3.%Fourier Heat conduction clear; close all; clc; h = 1;n = 11;T = ones(n,1); Told = T;T(1) = 1; %Left boundaryT(n) = 10; %Right boundaryx = linspace(0,1,n);dx =
4、 x(2)-x(1);dt = dx2/3; %cfl condition error = 1;TOL = 1e-6;k = 0;while error TOL, Told = T; k = k+1; for i = 2:n-1 T(i) = dt*(Told(i+1)-2*Told(i)+Told(i-1)/dx2+Told(i); end error = max(abs(T-Told); if mod(k,5)=0, out(k,:) = T; end end plot(x,out)xlabel(x),ylabel(Temperature),title(Fourier Heat Condu
5、ction),%legend(Cooling Trend,Steady State)4. 2D Heat Equation%2D Heat Equation.clear; close all; clcn = 10; %grid has n - 2 interior points per dimension (overlapping)x = linspace(0,1,n); dx = x(2)-x(1); y = x; dy = dx;TOL = 1e-6; T = zeros(n);T(1,1:n) = 10; %TOPT(n,1:n) = 1; %BOTTOMT(1:n,1) = 1; %L
6、EFTT(1:n,n) = 1; %RIGHTdt = dx2/4;error = 1; k = 0; while error TOL k = k+1; Told = T; for i = 2:n-1 for j = 2:n-1 T(i,j) = dt*(Told(i+1,j)-2*Told(i,j)+Told(i-1,j)/dx2 . + (Told(i,j+1)-2*Told(i,j)+Told(i,j-1)/dy2) . + Told(i,j); end end error = max(max(abs(Told-T); endsubplot(2,1,1),contour(x,y,T),t
7、itle(Temperature (Steady State),xlabel(x),ylabel(y),colorbarsubplot(2,1,2),pcolor(x,y,T),shading interp,title(Temperature (Steady State),xlabel(x),ylabel(y),colorbar5. Wave Translation%Oscillations - translation left and right clear; close all; clc; for c = 1 -1cc = 0;n = 261; x = linspace(0,13,n);u
8、 = zeros(n,1);u(121:141) = sin(pi*x(121:141);dx = x(2)-x(1);dt = dx;error = 1;TOL = 1e-6;k = 0;while k 110 uold = u; k = k+1; for i = 2:n-1 if c = 1, u(i) = dt*c*(uold(i+1)-uold(i)/dx+uold(i); end %c = 1 if c = -1, u(i) = dt*c*(uold(i)-uold(i-1)/dx+uold(i); end %c = -1 end error = max(abs(u-uold); i
9、f mod(k,10)=0, cc = cc+1; out(cc,:) = u; end end if c = 1subplot(2,1,1),for hh = 1:ccplot(x,out(hh,:)+hh),hold on,endu = zeros(n,1);u(121:141) = sin(pi*x(121:141); plot(x,u)xlabel(u(x),ylabel(Time),title(Translation to the Left)elseif c = -1subplot(2,1,2),for hh = 1:ccplot(x,out(hh,:)+hh),hold on,en
10、du = zeros(n,1);u(121:141) = sin(pi*x(121:141); plot(x,u)xlabel(u(x),ylabel(Time),title(Translation to the Right)endend6.%wave equationclear; close all; clc;c = 1;n = 21; x = linspace(0,1,n); dx = 1/(n-1);dt = dx;u(:,1) = sin(pi*x);u(1,2) = 0;for i = 2:n-1u(i,2) = 0.5*(dt2*c2*(u(i+1,1)-2*u(i,1)+u(i-1,1)/dx2+2*u(i,1);endu(n,2) = 0;error = 1; k = 1;while k 100 k = k+1; u(1,k+1) = 0; for i = 2:n-1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年世界民俗文化节展品陈列合作协议
- 2025年闭式冷却塔项目申请报告
- 2025年企业招投标合同管理权威指导
- 2025年信贷业务代理合同
- 2025年道路桥梁工程建设安全合同协议
- 2025年劳动力合同绩效管理性签订
- 2025年停车场所停车位租赁合同范文
- 2025年临翔区互联网产业合作框架协议
- 2025年饮品供应长期合同
- 2025年工程用瓷砖订购合同示范
- 会计专业工作简历表(中级)
- 金融科技课件(完整版)
- 医院压力性损伤患者质控标准
- 人教版七年级上册数学试卷全册
- 医疗机构规章制度诊所诊所规章制度
- 六年级小升初语文试卷 [六年级下册语文小升初试卷
- 幼儿园中班开学第一课
- 饮品店操作流程图
- 风居住的街道钢琴二胡合奏谱
- PADS元件封装制作规范要点
- 胶水行业中最常用的英文术语
评论
0/150
提交评论