



下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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),
2、title(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); p
3、lot(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);
4、dx = 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 c
5、onduction),%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
6、; %leftt(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); end精品.subplot(2,1,1),contour(x
7、,y,t),title(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,
8、13,n);u = 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-u
9、old); if 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),hol
10、d 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 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
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 妊娠合并貧血護(hù)理
- 項(xiàng)目建造成本管理培訓(xùn)
- 腹脹診斷流程
- 小班雨水節(jié)氣主題活動(dòng)方案
- 顏色有趣游戲課件
- 健康教育學(xué)會(huì)感恩
- 精神科護(hù)理匯報(bào)
- 構(gòu)成與設(shè)計(jì)核心要素
- 2025年水泥熟料及水泥項(xiàng)目提案報(bào)告
- 2025年教學(xué)專用儀器項(xiàng)目立項(xiàng)申請(qǐng)報(bào)告
- 9日益重要的國(guó)際組織(第3課時(shí)) 教學(xué)設(shè)計(jì)-六年級(jí)下冊(cè)道德與法治
- 浙江省慈溪市2024年小升初語(yǔ)文真題試卷及答案
- 2023年上海高中學(xué)業(yè)水平合格性考試歷史試卷真題(含答案詳解)
- 2024-2030年中國(guó)商品混凝土行業(yè)市場(chǎng)發(fā)展分析及發(fā)展趨勢(shì)與投資發(fā)展前景研究報(bào)告
- CJJT259-2016 城鎮(zhèn)燃?xì)庾詣?dòng)化系統(tǒng)技術(shù)規(guī)范
- 病案首頁(yè)填寫(xiě)及質(zhì)控要求
- 18 設(shè)計(jì)緊急避難路線圖(教案)人美版(北京)(2012)美術(shù)三年級(jí)下冊(cè)
- 園林綠化移樹(shù)合同
- 排球大單元計(jì)劃教學(xué)設(shè)計(jì)-高一上學(xué)期體育與健康人教版
- 玻璃粉燒工藝
- 云計(jì)算和邊緣計(jì)算在工業(yè)互聯(lián)網(wǎng)中的融合
評(píng)論
0/150
提交評(píng)論