




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、234 56 7,cos 2(7 1)iix tAft8,1cos 2(72)iix tAuft9% File: c7_sinewave.mf = 1;% frequency of sinusoidfs = 100;% sampling frequencyt = (0:200)/fs;% time vectorfor i=1:20 x(:,i) = cos(2*pi*f*t+rand(1)*2*pi); y(:,i) = cos(2*pi*f*t+rand(1)*pi/2); z(:,i) = (1+rand(1)*cos(2*pi*f*t);endsubplot(3,1,1); plot(t
2、,x,k); ylabel(x(t)subplot(3,1,2); plot(t,y,k); ylabel(y(t)subplot(3,1,3); plot(t,z,k); ylabel(z(t)% End of script file.10 11 00.511.52-101x(t)00.511.52-101y(t)00.511.52-202z(t)1200.20.40.60.811.21.41.61.82-101x(t)00.20.40.60.811.21.41.61.82-101y(t)00.20.40.60.811.21.41.61.82-202z(t)13 14x=random bin
3、ary(nbits,nsamples)+i*random binary (nbits,nsamples) 101Sample Indexxd020406080-101Sample Indexxq160100200300400500600700800-1.5-1-0.500.511.5Sample Indexxd0100200300400500600700800-1.5-1-0.500.511.5Sample Indexxq171mod( )(73)iixaxcm18191mod( )(74)iixaxcm20 212211(714)makm 1,1,2,3,2(715
4、)iakimm 23242526% File: c7_LCDemo1.mm = 2048; c = 1; seed = 1;% default values of m and ca1 = 65; a2 = 1229;% multiplier valuesix1 = seed; ix2 = seed;% initialize algorithmx1 = zeros(1,m); x2 = zeros(1,m); % initialize arraysfor i=1:m ix1 = rem(ix1*a1+c),m); x1(i) = ix1/m; ix2 = rem(ix2*a2+c),m); x2
5、(i) = ix2/m;endsubplot(1,2,1)y1 = x1(1,2:m),x1(1,1);plot(x1,y1,.)% plot results for a1subplot(1,2,2)y2 = x2(1,2:m),x2(1,1);plot(x2,y2,.)% plot results for a2% End of script file.2700.5100.20.40.60.8100.5100.20.40.60.812822211 1(7 19)1 NnNnNX nX nDNXn2222(720)xDEXYE XEXYa2921(721)YXZ222222112 111(722
6、)DEXXZZ30% File: c7_Durbinfunction D = durbin(x)N = length(x);% length of input vectory = x-mean(x);% remove dcydiff = y(2:N)-y(1:(N-1);% numerator summandNum = sum(ydiff.*ydiff);% numerator factor of D Den = sum(y.*y);% denominator factor of DD = Num/Den;% Durbin factor% End of function file.222221
7、1(723)D 31% File: c7_LCDemo2m = 2048; c = 1; seed = 1;a1 = 65; a2 = 1229;ix1 = 1; ix2 = 1;x1 = zeros(1,m); x2 = zeros(1,m);for i=1:m ix1 = rem(ix1*a1+c),m); x1(i) = ix1; ix2 = rem(ix2*a2+c),m); x2(i) = ix2;endD1 = c7_Durbin(x1); D2 = c7_Durbin(x2); % calculate Durbin parametersrho1 = 1-D1/2; rho2 =
8、1- D2/2;% calculate correlationtext1 = The value of D1 is ,num2str(D1), and rho1 is ,num2str(rho1),.;text2 = The value of D2 is ,num2str(D2), and rho2 is ,num2str(rho2),.; disp(text1)disp(text2)% End of script file.32c71.CDemo2The value of D1 is 1.9925 and rhol is 0.0037273.The value of D2 is 1.6037
9、 and rho2 is 0.19814.3334 xi+1(16807xi)mod(2147483647) (7-24) ( )cos210000 10000cos210001 10000(725)x ttt35111171mod 30269(726)170mod 30307(727)172mod 30323(728)iiiiiixxyyzz36 mod 1(729)302693030730323iiiixyzu16555425264690(730)a 1330269 30307 303232.7817 10(731)m 37 3839404142(732)XUFX 1(733)XXFU43
10、 Pr(734)XFxXx44 1PrPr(735)XXXFxFUxUFxFx45 exp -( ), 0(736)Xfxx u x1,0( )=(737)0,0 xu xx 0exp -exp(738)xXFxy dyxexp(739)XU 46exp(740)XU 1ln(741)XU 47% File: c7_uni2expclear all% be safen = input(Enter number of points );b = 3;% set pdf parameteru = rand(1,n);% generate Uy_exp = -log(u)/b;% transforma
11、tionN_samp,x = hist(y_exp,20);% get histogram parameterssubplot(2,1,1)bar(x,N_samp,1)% plot histogramylabel(Number of Samples)xlabel(Independent Variable - x)subplot(2,1,2)y = b*exp(-3*x);% calculate pdfdel_x = x(3)-x(2);% determine bin widthp_hist = N_samp/n/del_x;% probability from histogramplot(x
12、,y,k,x,p_hist,ok)% compareylabel(Probability Density)xlabel(Independent Variable - x)legend(true pdf,samples from histogram,1) % End of script file.4800.511.520102030Number of SamplesIndependent Variable - x00.511.520123Probability DensityIndependent Variable - xtrue pdfsamples from histogram4900.51
13、1.522.5305001000Number of SamplesIndependent Variable - x00.511.522.530123Probability DensityIndependent Variable - xtrue pdfsamples from histogram50 222=exp(742)2Rrrfru r 222220=expexp(743)22rRyyrFrdy5122exp(744)2RU22exp(745)2RU22ln(746)RU525302468050010001500Number of SamplesIndependent Variable -
14、 x0246800.20.4Probability DensityIndependent Variable - xtrue pdfsamples from histogram54% File: c7_uni2rayclear all% be safen = input(Enter number of points );varR = 3;% set pdf parameteru = rand(1,n);% generate Uy_exp = sqrt(-2*varR*log(u);% transformationN_samp,r = hist(y_exp,20);% get histogram
15、parameterssubplot(2,1,1)bar(r,N_samp,1)% plot histogramylabel(Number of Samples)xlabel(Independent Variable - x)subplot(2,1,2)term1 = r.*r/2/varR;% exponentray = (r/varR).*exp(-term1);% Rayleigh pdfdel_r = r(3)-r(2);% determine bin widthp_hist = N_samp/n/del_r;% probability from histogramplot(r,ray,
16、k,r,p_hist,ok)% compare resultsylabel(Probability Density)xlabel(Independent Variable - x)legend(true pdf,samples from histogram,1)% End of script file.555611Pr(747)iiiiiiPxxxcxx11( )(748)XiiiFxFcxx1111Pr(749)iiijjFXxP11()(750)XiiiFXUFcXx111(751)iiiXxUFc571(752)iiFUF58 for all(753)XXMgxfx x / ,0(754
17、)0,XbM axaMgxothers59 /max(755)XbM afx 6061 0Pr accepted (756)aXifx dxVab11Pr accepted (757)iVabM62 11111Pr +,accepted Pr );% set Nfx = zeros(1,N);% array of output samplesu1 = rand(1,N); u2 = rand(1,N);% generate u1 and u2v1 = R*u1;% generate v1v2 = (M/R)*rand(1,N);% generate v2 (g(x)kpts = 0;% ini
18、tialize counterfor k=1:N if v2(k)(M/(R*R)*sqrt(R*R-v1(k)*v1(k); kpts=kpts+1;% increment counter fx(kpts)=v1(k); % save output sample endendfx = fx(1:kpts);N_samp,x = hist(fx,20);% get histogram parameterssubplot(2,1,1)bar(x,N_samp,1)% plot histogramylabel(Number of Samples)xlabel(Independent Variabl
19、e - x)subplot(2,1,2)yt = (M/R/R)*sqrt(R*R-x.*x);% calculate pdfdel_x = x(3)-x(2); % determine bin widthp_hist = N_samp/kpts/del_x;% probability from histogramplot(x,yt,k,x,p_hist,ok)% compareylabel(Probability Density)xlabel(Independent Variable - x)legend(true pdf,samples from histogram,3)text = Th
20、e number of points accepted is ,. num2str(kpts,15), and N is ,num2str(N,15),.;disp(text) % End of script file.65024680100200Number of SamplesIndependent Variable - x0246800.10.2Probability DensityIndependent Variable - xtrue pdfsamples from histogram6602468010002000Number of SamplesIndependent Varia
21、ble - x0246800.10.2Probability DensityIndependent Variable - xtrue pdfsamples from histogram6768221( )exp1(761)22xXyxFxdyQ 2exp/2(762)xQ xydy691/2(763)Nii=0YBU -70 1/2(764)Nii=0E YBE U- 2var1/2(765)iUx dx2var(766)NyiiBU 2(767)yNB7172(768)yBN(769)2yNN737475762222222211( , )expexp22221exp(770)22XYxyfx
22、 yxy77222(771)xyr1tan(772)yx,(773)RRXYXYfrdAfx y dA cossin,(774)XYRXYx rRy rdAfrfx y dA78/,/,cossin(775)sincosXYRdx drdx dx ydAdy drdy ddArrr r222,exp,220,02(777)Rrrfrr 79 22222220expexp,2220(778)Rrrrrfrdr 22201exp,22202(779)rrfdr 80cos(780)XR sin(781)YR 2122lncos2(782)XUU 2122lnsin2(783)YUU 81% Fil
23、e: c7_boxmul.mfunction out1,out2=c7_boxmul(N)u1 = rand(1,N);% generate first uniform RVu2 = rand(1,N);% generate second uniform RVray = sqrt(-2*log(u1);% generate Rayleigh RVout1 = ray.*cos(2*pi*u2);% first Gaussian outputout2 = ray.*sin(2*pi*u2);% second Gaussian output% End of function file.828384
24、Pr10.2146(784)circleboxAreject A 858687888921(785)ZXY 222222221211(786)ZEXYE XE XYE Y 2222221(787)Z 902(788)E XZ 22(789)XZXZE XZ 9120/2(790)nsN f 202(791)snfN 2( )( )(792)YXSfH fSf 9293 2( )(793)YSfH fK ( )/(794)YH fSfK 94 10111(795)1nnnnbb zb zH z a za z95 000|(796)/|ffHf Kfff9600.20.40.60.810246Normalized FrequencyMagnitude Response00.20.40.60.810246Normalized FrequencyMagnitude Response97 21/ 1/,|(797)0,ddffffS f others 1/421/,|(798)0,ddffffHf others989900.020.040.060.08-0.500.5TimeImpulse Response-1000-5000500100000.511.5x 10-3FrequencyPSD100-5000500-40-200FrequencyPSD0
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 國家機關(guān)勞動合同樣本合同
- 工廠保安用工合同
- 消防課程安全課件
- 智能儀器儀表智能醫(yī)療應(yīng)用考核試卷
- 成人高考地理知識要點專項訓練考核試卷
- 斯洛文尼亞網(wǎng)絡(luò)廣告競爭格局洞察考核試卷
- 文化用品租賃業(yè)務(wù)項目管理考核試卷
- 機場航站樓空氣質(zhì)量控制考核試卷
- 2024信息物理融合智能系統(tǒng)實施流程
- 資金籌劃咨詢合同范本
- 人類行為與社會環(huán)境全套課件
- 運輸管理實務(wù)教案
- 上課用03工程中的價值利益與公正課件
- 司機安全培訓課件
- 公司年度虧損專項治理方案
- 鋼結(jié)構(gòu)施工進度計劃保障措施
- 低鉀血癥與橫紋肌溶解綜合征
- 交通運輸設(shè)備整套課件匯總完整版電子教案(全)
- 《汽車概論》第二版全套電子課件完整版ppt整本書電子教案最全教學教程整套課件
- 寶寶相冊生日祝??蓯劭ㄍ娮酉鄡訮PT模板
- T∕CACM 1232-2019 中醫(yī)內(nèi)科臨床診療指南 真心痛(PCI術(shù)后)
評論
0/150
提交評論