版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、% File: c3_upsampex.mM = 6;% upsample factorh = c3_lininterp(M);% imp response of linear interpolatort = 0:10;% time vectortu = 0:60;% upsampled time vectorx = sin(2*pi*t/10); % original samplesxu = c3_upsamp(x,M);% upsampled sequence原理:使用線性內(nèi)插器h(n)與上采樣值X(kTu)=X(kT/)卷積,從而使每?jī)蓚€(gè)采樣值中放入M-1個(gè)零值樣點(diǎn),即使采樣頻率提高M(jìn)倍
2、。功能:通過線性內(nèi)插來提高采樣頻率。File: c8_welchp.mfs = 16;x = random_binary(1024,fs)+i*random_binary(1024,fs);for nwin=1:4 nwindow = nwin*1024; pxx,f = pwelch(x,nwindow,fs); pxx = pxx/sum(sum(pxx); n2 = length(f)/2; pxxdB = 10*log10(pxx/pxx(1); ptheory = sin(pi*f+eps)./(pi*f+eps); ptheory = ptheory.*ptheory; ptheo
3、rydB = 10*log10(ptheory/ptheory(1); subplot(2,2,nwin) plot(f(1:n2),pxxdB(1:n2),f(1:n2),ptheorydB(1:n2) ylabel(PSD in dB) xx = window length = ,num2str(nwindow); xlabel(xx) axis(0 8 -50, 10); grid;end % End of script file.原理:由直方圖可以估計(jì)樣本的PSD功能:考察不同的樣本個(gè)數(shù)與直方個(gè)數(shù)對(duì)直方圖法的影響,樣本符合高斯分布。File: c4_qamdemo.mlevelx =
4、input(Number of D levels );levely = input(Number of Q levels );m = input(Number of symbols );n = input(Number of samples per symbol );bw = input(Filter bandwidth, 0bw );xd,xq = qam(levelx,levely,m,n);b,a = butter(6,bw);% determine filter coefficientsyd = filter(b,a,xd);% filter direct coefficientyq
5、= filter(b,a,xq);% filter quadrature coefficientsubplot(2,2,1)% first paneplot(xd,xq,o)% unfiltered scatterplotsubplot(2,2,2)% second paneplot(yd,yq)% filtered scatterplotsym = 30;% number of symbols in time plotnsym = (0:sym*n)/n;% x axis vector for time plotssubplot(2,2,3)% third pane plot(nsym(1:
6、sym*n),yd(1:sym*n) % filtered direct component subplot(2,2,4)% fourth paneplot(nsym(1:sym*n),yq(1:sym*n) % filtered quadrature componentFile: mary.mfunction y= mary(levels,m,n)l = m*n; % Total sequence lengthy = zeros(1,l-n+1); % Initalize output vectorlm1 = levels-1;x=2*fix(levels*rand(1,m)-lm1;for
7、 i = 1:m = (i-1)*n+1; y(k) = x(i); % Loop to generate info symbolsk y = conv(y,ones(1,n); % Make each symbol n samplesFile: qam.mfunction xd,xq = qam(levelx,levely,m,n)xd = mary(levelx,m,n);xq = mary(levely,m,n);原理:利用兩個(gè)子程序生成兩個(gè)函數(shù),通過六階巴特沃斯濾波器,畫出散點(diǎn)圖及時(shí)域波形圖。功能:畫出16-QAM的符號(hào)的散點(diǎn)圖和通過六階巴特沃斯濾波器后的散點(diǎn)圖,以及16-QAM的符號(hào)
8、的同相和正交分量的時(shí)域波形圖。File: c5_threefilters.mT = 0.01;f = 0:0.1:50;z = exp(-i*2*pi*f*T); % see (5.4)a0 = 0.239057;a1 = 0.239057; b1 = 0.521886; % bilinear invariantnum = a0+a1*z;den = 1-b1*z;ampx = abs(num./den);a0 = 0.628319; b1 = 0.533488; % impulse invariantnum = a0;den = 1-b1*z;ampy = abs(num./den);a0
9、= 1.0; a1 = 0.533488; b1 = 0.533488; % step invriantnum = (a0-a1)*z;den = 1-b1*z;ampz = abs(num./den);模擬濾波器Ha(s)=a/(s+a),通過沖激響應(yīng)不變法,階躍響應(yīng)不變法,可分別設(shè)計(jì)數(shù)字濾波器。功能:假設(shè)采樣頻率為100HZ,模擬濾波器的3dB頻率為10HZ,設(shè)計(jì)matlab程序,比較三種濾波器的響應(yīng)。File: c5_ellipexam.mfs = 100;% set sampling frequencyfc = 20;% set cuttoff frequencyf = 0:0.1:5
10、0;% define frequency vectorb,a = ellip(5,1,20,2*pi*fc,s); % synthesize elliptic filterh = freqs(b,a,2*pi*f);% amp. resp. of analog filterbz1,az1 = impinvar(b,a,fs);% impulse invariant digital filterh1 = freqz(bz1,az1,f,fs);% amplitude response of abovebz2,az2 = bilinear(b,a,fs);% bilinear z filter (
11、not prewarped)h2 = freqz(bz2,az2,f,fs);% amplitude response of abovebz3,az3 = bilinear(b,a,fs,fc);% bilinear z filter (prewarped)h3 = freqz(bz3,az3,f,fs);% amplitude response of abovesubplot(211)% subplot 1plot(f,abs(h),f,abs(h1)% plotxlabel(Frequency - Hz)% label x axisylabel(Amplitude Response)% l
12、abel y axissubplot(212)% subplot 2plot(f,abs(h2),f,abs(h3)% plotxlabel(Frequency - Hz)% label x axisylabel(Amplitude Response)% label y axis原理:其中c=2fa.cot(fdT)。使fa=fd的方法為預(yù)畸變,使c=2/T=2fs的方法稱為近似線性變換。功能:產(chǎn)生模擬原型幅度響應(yīng),沖激不變?yōu)V波器幅度響應(yīng)以及兩種雙線性變換濾波器的幅度響應(yīng)并比較。File: c5_FIRdesign.mL = 30;% 2L+1 total pointslam = 0.3;%
13、normalized cutoff frequencym = -L:1:L;% vector of pointsbp = sin(pi*lam*(m+eps)./(pi*(m+eps); % impulse responsestem(0:2*L,bp,.)% plot impulse responsexlabel(Sample index)ylabel(Impulse response)figure; a = 1; freqz(bp,a)% plot amp and phase responsefigure; subplot(2,1,1)% new figureH w = freqz(bp,a
14、);plot(w/pi,abs(H); grid;% unwindowed amp responsexlabel(Frequency (normalized to the Nyquist frequency = fs/2)ylabel(|H(f)| (unwindowed)subplot(2,1,2)w = 0.54+0.46*cos(pi*m/L);% Hamming windowwbp = bp.*w;% apply windowH w = freqz(wbp,a);plot(w/pi,abs(H); grid;% windowed amp response原理:濾波器的頻率響應(yīng)與單位沖激
15、響應(yīng)是一對(duì)傅里葉變換對(duì),對(duì)于給出幅頻響應(yīng)A(f)可計(jì)算出h(m);經(jīng)過加窗,使通帶波形得到抑制從而獲得更好的數(shù)字低通濾波器。功能:設(shè)計(jì)一個(gè)具有h(m)=(1/m)*sin(m)沖激響應(yīng)的數(shù)字濾波器。File: c5_firbutter.morder = 30;fc =5;% set filter parametersfmax = 100;% set max frequencynpts = 256;% set number of samplesf = (0:(npts-1)*(fmax/(npts-1);% frequency vectornn = 2*npts;% size ifftH = z
16、eros(1,nn);% initialize vectorHa = 1./(sqrt(1+(f/fc).order);% amplitude responseH = Ha 0 fliplr(Ha(2:npts);% even amplitude responsecimp_resp = ifft(H,nn);% complex impulse responseimp_resp = real(cimp_resp);% take real partaa = imp_resp(1:npts);% time = 0bb = imp_resp(npts+1):nn);% time );varR = 3;
17、% set pdf parameteru = rand(1,n);% generate Uy_exp = sqrt(-2*varR*log(u); % transformationN_samp,r = hist(y_exp,20); % get histogram 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/v
18、arR).*exp(-term1); % Rayleigh pdfdel_r = r(3)-r(2); % determine bin widthp_hist = N_samp/n/del_r; % probability from histogramplot(r,ray,k,r,p_hist,ok) % compare results原理:利用逆變換法把均勻分布變換為瑞利分布功能:用直方圖畫出均勻分布的瑞利分布File: c8_PSDexample.msettle = 100;% ignore transientfs = 1000;% sampling frequencyN = 50000;
19、% size of data recordf = (0:(N-1)*fs/N;% frequency scaleb,a = cheby1(5,5,0.1);% filterNN = N+settle;% allow transient to diein = randn(1,NN);% random inputout = filter(b,a,in);% filter outputout = out(settle+1):NN);% strip off initial sampleswindow = hanning(N);% set window functionwinout = out.*win
20、dow;% windowed filter outputfout = abs(fft(winout,N).2;% transform and square magU = sum(window.*window);% window energyf1out = fout/U;% scale spectrumpsd1 = 10*log10(abs(f1out);% log scaleK = 25;% number ofsegments M = N/K;% block sizefK = (0:(M-1)*fs/M;% frequency scaled = zeros(1,M);% initialize
21、vectorpsdk = zeros(1,M);% initialize vectorwindow = hanning(M);% set window functionU = sum(window.*window);% window energyfor k=1:Kpsd2 = 10*log10(psdk/K);原理:通過加窗的周期圖法以及分段周期圖法設(shè)計(jì)PSD功能:將白噪聲通過切比雪夫?yàn)V波器并通過兩種周期圖法估計(jì)PSDFile: c9_MCBFSK.msnrdB_min = 0; snrdB_max = 10;% SNR (in dB)limitssnrdB = snrdB_min:1:snr
22、dB_max;Nsymbols = input(Enter number of symbols );snr = 10.(snrdB/10);% convert from dBh = waitbar(0,SNR Iteration);len_snr = length(snrdB);for j=1:len_snr % increment SNR waitbar(j/len_snr) sigma = sqrt(1/(2*snr(j); % noise standard deviation error_count = 0; for k=1:Nsymbols % simulation loop begins d = round(rand(1); % data if d =0 x_d = 1;% direct transmitter ou
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 普通述職報(bào)告
- 新應(yīng)急預(yù)案編制
- 保護(hù)家庭網(wǎng)絡(luò)安全的方法
- 股票實(shí)戰(zhàn)課件教學(xué)課件
- 交通安全人人有責(zé)
- DB1304T 492-2024農(nóng)村消防設(shè)施管理指南
- 傳媒經(jīng)營(yíng)管理
- 校園艾滋病健康
- 初中引體向上教案
- 菱形的性質(zhì)說課稿
- 五年級(jí)上冊(cè)口算練習(xí)400題及答案
- 就業(yè)引航筑夢(mèng)未來
- 電子信息工程專業(yè)大學(xué)生生涯發(fā)展展示
- 班會(huì)議題探索未來職業(yè)的發(fā)展趨勢(shì)
- 跨境電商營(yíng)銷(第2版 慕課版)教案 項(xiàng)目五 社會(huì)化媒體營(yíng)銷
- 2024年中國(guó)鐵路成都局集團(tuán)有限公司招聘筆試參考題庫含答案解析
- 藝術(shù)機(jī)構(gòu)退費(fèi)制度
- 《河流(第2課時(shí))》公開課教學(xué)設(shè)計(jì)【人教八年級(jí)地理上冊(cè)】
- 食堂員工培訓(xùn)內(nèi)容-食堂從業(yè)人員培訓(xùn)資料
- 諾如病毒幼兒園知識(shí)講座
- 電子商務(wù)平臺(tái)2024年電子商務(wù)平臺(tái)選擇與搭建指南
評(píng)論
0/150
提交評(píng)論