![數(shù)值傳熱學第四章編程題_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/76249c4f-9587-4310-aebc-1a87d93c5d00/76249c4f-9587-4310-aebc-1a87d93c5d001.gif)
![數(shù)值傳熱學第四章編程題_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/76249c4f-9587-4310-aebc-1a87d93c5d00/76249c4f-9587-4310-aebc-1a87d93c5d002.gif)
![數(shù)值傳熱學第四章編程題_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/76249c4f-9587-4310-aebc-1a87d93c5d00/76249c4f-9587-4310-aebc-1a87d93c5d003.gif)
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、精品好資料學習推薦4-5迭代法求解節(jié)點溫度。說明:此處給出的是C+程序代碼,使用牛頓迭代法,迭代收斂精度1.0e-6;程序運行結(jié)果附后。/*NHT 4-5 newton*created on 2012-10-19 by Sanye*/#include #include #include using namespace std;int main() double funT=1.0,dfunT=1.0,temp1=1.0,temp2=1.0; double T=20.0;/primary value int i=0; /for TEST! coutprimary T= T ;=1.0e-6) i+
2、; if(i=1&(T=20.0)T=100.0;/in case unreasonable T; temp1=pow(T-20.0,0.25);temp2=pow(T-20.0,-0.75); funT=0.5*T-80+2*T*temp1-40*temp1; dfunT=0.5+2*temp1+0.5*T*temp2-10*temp2; T=T-funT/dfunT; cout step i;tT3-T3= funT/dfunT ;endl; couttotal steps: iendl; couttT1= 100tT2= 0.5*(T+130)tT3= T endl; return 0;
3、運行結(jié)果:4-12 編寫TDMA算法程序驗證其正確性。說明:此處給出的是C+程序代碼,程序運行結(jié)果附后。/*TDMA.cpp *Created on 2012-10-19 by Sanye*/#include #include #include #include #include TDMA.husing namespace std;int main() int num=10;/num: number of T points; vector A,B,C,D,T_before,T_after; int rand_temp1,rand_temp2; /*Generate A,B,C,D,T_befo
4、re Randomly*/ for(int i=0;inum;+i) rand_temp1=rand()%10; rand_temp2=rand()%20; A.push_back(1.0+rand_temp1/2.0); B.push_back(rand_temp2/(rand_temp1+3.0)/5.0+1.0); C.push_back(rand_temp1*rand_temp2/10.0+2.0); T_before.push_back(sqrt(i*i+1.0)*11.0-20.0); B0=0.0;Cnum-1=0.0; for(int i=0;inum;+i) double t
5、emp; if(i=0) temp=A0*T_before0-B0*T_before1; else if(i=num-1) temp=Anum-1*T_beforenum-1-Cnum-1*T_beforenum-1-1;else temp=Ai*T_beforei-Bi*T_beforei+1-Ci*T_beforei-1; D.push_back(temp); /*Get T_after*/ T_after.resize(num); T_after=TDMA(A,B,C,D); /*Calculate T_err*/ vector T_err; for(int i=0;inum;+i)T_
6、err.push_back(T_afteri-T_beforei); /*Cout T*/ cout.setf(ios:fixed); cout.precision(4); for(int i=0;inum;+i) coutT_beforei+1= T_beforeitT_afteri+1= T_afteri tT_erri+1= T_erri endl; return 0;/* TDMA.h*/#ifndef TDMA_H_INCLUDED#define TDMA_H_INCLUDED#include using namespace std;vector TDMA(vector &A, vector &B, vector &C, vector &D)vector P,Q,T; int n=A.size(); P.resize(n); Q.resize(n); T.resize(n); /*Get P,Q*/
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 教育行業(yè)在線教育平臺的課程評價體系方案
- 造價咨詢合同
- 2025年天津貨運從業(yè)資格證模擬試題答案解析大全
- 2025年寧德貨物運輸駕駛員從業(yè)資格考試系統(tǒng)
- 電子消費券采購合同(2篇)
- 電力電量分配合同(2篇)
- 電池焊接維修合同(2篇)
- 2024年高考歷史二輪復習“12+2+3”專項練第46題選做題專練
- 2024-2025學年四年級語文上冊第五單元19奇妙的國際互聯(lián)網(wǎng)教案2蘇教版
- 2024-2025學年高中化學第二章化學反應與能量第二節(jié)化學能與電能2發(fā)展中的化學電源課時訓練含解析新人教版必修2
- 早點出租承包合同(2篇)
- 內(nèi)鏡室院感知識培訓課件
- 2025年市場拓展工作計劃
- 2025年八省聯(lián)考云南高考生物試卷真題答案詳解(精校打印)
- 2020-2024年五年高考歷史真題分類匯編(山東)專題15 中國古代史(原卷版)
- (房屋建筑部分)工程建設標準強制性條文版
- 《大學英語四級詞匯大全》
- 倉庫管理培訓課件
- 第六章-1八綱辨證
- 《中國古典建筑》課件
- 礦山生態(tài)修復施工方案及技術(shù)措施
評論
0/150
提交評論