


下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、精品好資料學(xué)習(xí)推薦4-5迭代法求解節(jié)點(diǎn)溫度。說(shuō)明:此處給出的是C+程序代碼,使用牛頓迭代法,迭代收斂精度1.0e-6;程序運(yùn)行結(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、運(yùn)行結(jié)果:4-12 編寫TDMA算法程序驗(yàn)證其正確性。說(shuō)明:此處給出的是C+程序代碼,程序運(yùn)行結(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. 本站所有資源如無(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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 人教版歷史與社會(huì)七年級(jí)上冊(cè)教學(xué)設(shè)計(jì):3.3.1-耕海牧漁
- 庫(kù)房轉(zhuǎn)讓合同范本
- 2025年度餐飲業(yè)環(huán)保產(chǎn)品采購(gòu)合同
- 2025年度全球供應(yīng)鏈管理出口貿(mào)易三方合作協(xié)議
- 2025年度范文大全固定資產(chǎn)租賃合同多功能版
- 2025年度博物館陳列室裝修設(shè)計(jì)與施工合同
- 2025年面包粉線行業(yè)深度研究分析報(bào)告
- Unit 6 Enjoy Cycling Topic 3 Bicycle riding is good exercise Section C 教學(xué)設(shè)計(jì)-2024-2025學(xué)年仁愛科普版英語(yǔ)八年級(jí)下冊(cè)
- Starter Unit 3 Welcome Section A 1a-2d 教學(xué)設(shè)計(jì) 2024-2025學(xué)年人教版(2024)七年級(jí)英語(yǔ)上冊(cè)
- 壓力容器非標(biāo)項(xiàng)目可行性研究報(bào)告
- 景觀模型設(shè)計(jì)與制作:第7章 建筑模型制作基本技法
- 關(guān)愛婦女防治兩癌講座課件
- DL∕T 584-2017 3kV~110kV電網(wǎng)繼電保護(hù)裝置運(yùn)行整定規(guī)程
- (正式版)FZ∕T 80018-2024 服裝 防靜電性能要求及試驗(yàn)方法
- 北師大版八年級(jí)下冊(cè)生物教案全冊(cè)
- 穩(wěn)定性冠心病診斷與治療指南
- DL-T5704-2014火力發(fā)電廠熱力設(shè)備及管道保溫防腐施工質(zhì)量驗(yàn)收規(guī)程
- JT-T-610-2004公路隧道火災(zāi)報(bào)警系統(tǒng)技術(shù)條件
- 初中英語(yǔ)比較級(jí)和最高級(jí)專項(xiàng)練習(xí)題含答案
- 大壩安全監(jiān)測(cè)系統(tǒng)驗(yàn)收規(guī)范
- 2024年南京鐵道職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)及答案解析
評(píng)論
0/150
提交評(píng)論