南京郵電大學
實驗報告
實驗名稱熟悉matlab環境
快速傅利葉變換(fft)及其應用
iir數字濾波器的設計
fir數字濾波器的設計
課程名稱數字訊號處理a
班級學號 11002131
姓名康登飛
開課時間 2013/2014學年, 第二學期
實驗一熟悉matlab環境
一、 實驗目的
(1)熟悉matlab得主要操作命令。
(2)學會簡單的矩陣輸入和資料讀寫。
(3)掌握簡單的繪圖命令。
(4)用matlab程式設計並學會建立函式。
(5)觀察離散系統的頻率響應。
二、 實驗內容
(1) 陣列的加、減、乘、除和乘方運算。輸入a=[1 2 3 4],b=[3,4,5,6],求
c=a+b, d=a-b,e=a.*b,f=a./b,g=a.^b 。並用stem語句畫出a、b、c、d、
e、f、g。
解: clear
n = 0:1:3;
a=[1 2 3 4];
subplot(4,2,1)
stem(n,a)
xlabel('n')
ylabel('a')
b=[3,4,5,6];
subplot(4,2,2)
stem(n,b)
xlabel('n')
ylabel('b')
c=a+b;
subplot(4,2,3)
stem(n,c)
xlabel('n')
ylabel('c')
d=a-b;
subplot(4,2,4)
stem(n,d)
xlabel('n')
ylabel('d')
e=a.*b;
subplot(4,2,5)
stem(n,e)
xlabel('n')
ylabel('e')
f=a./b;
subplot(4,2,6)
stem(n,f)
xlabel('n')
ylabel('f')
g=a.^b;
subplot(4,2,7)
stem(n,g)
xlabel('n')
ylabel('g')
(2) 用matlab實現下列序列:
a) [ 0≤n≤15', 'altimg': '70f54a96e118652dfb4e3d90f9d496ce.png', 'w':
'201', 'h': '26'}]
解:n=0:1:15;
x1=0.8.^n;
stem(n,x1)
xlabel('n')
ylabel('x(n)')
title('2(a)')
b) [ 0≤n≤15', 'altimg': '86e7247f89ab3e31693434f50fcce81f.png', 'w':
'230', 'h': '22'}]
解:n=0:1:15;
i=sqrt(-1);
a = 0.2+3*i;
x2=exp(a*n);
figure
subplot(1,2,1)
stem(n,real(x2))
xlabel('n')
ylabel('x(n)實部')
subplot(1,2,2)
stem(n,imag(x2))
xlabel('n')
ylabel('x(n)虛部')
c)解:n=0:1:15;
x3=3*cos(0.125*pi*n+0.2*pi) + 2*sin(0.25*pi*n+0.1*pi);
stem(n,x3)
xlabel('n')
ylabel('x(n)')
(4) 繪出下列時間函式的圖形,對x軸、y軸以及圖形上方均須加上適當的標註:
a) 解:
t=0:0.001:10;
x=sin(2*pi*t);
plot(t,x,'r-')
xlabel('t'),ylabel('x(t)'),title('sin(2\pit)')
b) 解:
t=0:0.001:4;
x=cos(100*pi*t).*sin(pi*t);
plot(t,x,'r-')
xlabel('t'),ylabel('x(t)'),title('cos(100\pi*t).*sin(\pi*t)')
(6) 給定一因果系統[z^+z^)/(10.67z^+0.9z^)', 'altimg':
'c1cb942276c95e612b0d113173124e34.png', 'w': '415', 'h':
'29'}],求出並繪製h(z)的幅頻響應和相頻響應。
解:k=256;
num=[1 1.414 1];
den=[1 -0.67 0.9];
w=0:pi/k:pi;
h=freqz(num,den,w);
subplot(2,2,1);
plot(w/pi,real(h));grid
title(' 實部')
xlabel('\omega/\pi');ylabel('幅度')
subplot(2,2,2);
plot(w/pi,imag(h));grid
title(' 虛部')
xlabel('\omega/\pi');ylabel('幅度')
subplot(2,2,3);
plot(w/pi,abs(h));grid
title(' 幅度譜')
xlabel('\omega/\pi');ylabel('幅度')
subplot(2,2,4);
plot(w/pi,angle(h));grid
title(' 相位譜')
xlabel('\omega/\pi');ylabel('幅度')
(7) 計算序列和序列的離散卷積,並作圖表示卷積結果。
解:x=[8,-2,-1,2,3];
kx=0:4;
h=[2,3,-1,-3];
kh=0:3;
y=conv(x,h);
k=kx(1)+kh(1):kx(end)+kh(end);
stem(k,y);
xlabel('n');ylabel('y(n)');
(8) 求以下差分方程所描述系統的單位脈衝響應h(n),
解:n=51;
a=[1 -2];
b=[1 0.1 -0.06];
x=[1 zeros(1,n-1)];
k=0:1:n-1;
y=filter(a,b,x);
stem(k,y);
xlabel('n');
ylabel('幅度');
;實驗二快速傅利葉變換(fft)及其應用
一、 實驗目的
(1) 在理論學習的基礎上,通過本實驗,加深對fft的理解,熟悉matlab中的有關函式。
(2) 應用fft對典型訊號進行頻譜分析。
(3) 了解應用fft進行訊號頻譜分析過程中可能出現的問題,以便在實際中正確應用fft。
(4) 應用fft實現序列的線性卷積和相關。
二、 實驗內容
實驗中用到的訊號序列
a)高斯序列
[(n)=\\left\\\\begine^}}&0≤n≤15\\\\ 0&其他\\\\ \\end\\end\\right.', 'altimg': 'ad1444a982e57bcc8951b71e1915bd4d.
png', 'w': '249', 'h': '97'}]
b)衰減正弦序列
[(n)=\\left\\\\begine^sin(2πfn)&0≤n≤15\\\\ 0&其他\\\\ \\end\\end\\right.', 'altimg': '531df7dc9bcc987fb65975963af68219.
png', 'w': '313', 'h': '80'}]
c)三角波序列
[(n)=\\left\\\\beginn&0≤n≤3\\\\ 8n&4≤n≤7\\\\ 0&其他\\\\ \\end\\end\\right.', 'altimg': 'c7684026df7405341d848e5756184317.
png', 'w': '207', 'h': '114'}]
d)反三角波序列
[(n)=\\left\\\\begin4n&0≤n≤3\\\\ n4&4≤n≤7\\\\ 0&其他\\\\ \\end\\end\\right.', 'altimg': 'dc96b1aceb502913bcc32047da54e120.
png', 'w': '209', 'h': '114'}]
(1) 觀察高斯序列的時域和幅頻特性,固定訊號[(n)', 'altimg': '2f126370b787d19888f6ccb7f3417773.png', 'w':
'53', 'h': '23'}]中引數p=8,改變q的值,使q分別等於2,4,8,觀察它們的時域和幅頻特性,了解當q取不同值時,對訊號序列的時域幅頻特性的影響;固定q=8,改變p,使p分別等於8,13,14,觀察引數p變化對訊號序列的時域及幅頻特性的影響,觀察p等於多少時,會發生明顯的洩漏現象,混疊是否也隨之出現?記錄實驗中觀察到的現象,繪出相應的時域序列和幅頻特性曲線。
解:function gauss(p,q)
n=0:1:15;
n=length(n);
xa=exp(-(n-p).^2/q);
m=10000;
w=2*pi/m*(0:1:m-1);
xa=zeros(1,m);
for k=1:m
xa(k)=sum(xa*(exp(-j*w(k)*(0:n-1)')));
endsubplot(2,1,1);
stem(n,xa);
xlabel('n'),ylabel('x_a(n)')
subplot(2,1,2);
plot(w,abs(xa))
xlabel('\omega'),ylabel('幅度譜')
>>gauss〔8,2〕
>>gauss(8,4)
>>gauss(8,8)
>>(13,8)
>>(14,8)
當p=13時發生明顯洩漏現象,混疊現象也產生。
(3) 觀察三角波和反三角波序列的時域和幅頻特性,用n=8點fft分析訊號序列[(n)', 'altimg': '9770c553f12076d1ba8ec80740661090.png', 'w':
'52', 'h': '23'}]和[(n)', 'altimg': 'b9ac2346c40a44fcc23e9414e1eda9ed.
png', 'w': '54', 'h': '23'}]的幅頻特性,觀察兩者的序列形狀和頻譜曲線有什麼異同?
繪出兩序列及其幅頻特性曲線。
在[(n)', 'altimg': '9770c553f12076d1ba8ec80740661090.png', 'w':
'52', 'h': '23'}]和[(n)', 'altimg': 'b9ac2346c40a44fcc23e9414e1eda9ed.
png', 'w': '54', 'h': '23'}]末尾補零,用n=32點fft分析這兩個訊號的幅頻特性,觀察幅頻特性發生了什麼變化?
兩種情況的fft頻譜還有相同之處嗎?這些變化說明了什麼?
解:clear;
for n=1:4
xc(n)=n-1;
end;
for n=5:8;
xc(n)=8-(n-1);
end;
%xc=[0,1,2,3,4,3,2,1];
n=0:1:7;
subplot(2,1,1)
stem(n,xc)
n = 8; %fft點數
%n=32; %%改變fft點數
xc=fft(xc,n);
k=0:1:n-1;
subplot(2,1,2)
plot(k,abs(xc))
clear;
for n=1:4
xc(n)=5-n;
end;
for n=5:8;
xc(n)=n-5;
end;
%xc=[0,1,2,3,4,3,2,1];
n=0:1:7;
subplot(2,1,1)
stem(n,xc)
n = 8; %fft點數
%n=32; %%改變fft點數
xc=fft(xc,n);
k=0:1:n-1;
subplot(2,1,2)
plot(k,abs(xc))
兩種情況頻譜圖一樣,三角波序列先增大後減小,反三角波序列先減小後增大。
clear;
for n=1:4
xc(n)=n-1;
end;
for n=5:8;
xc(n)=8-(n-1);
end;
%xc=[0,1,2,3,4,3,2,1];
n=0:1:7;
subplot(2,1,1)
stem(n,xc)
n = 32; %fft點數
%n=32; %%改變fft點數
xc=fft(xc,n);
k=0:1:n-1;
subplot(2,1,2)
plot(k,abs(xc))
clear;
for n=1:4
xc(n)=5-n;
end;
for n=5:8;
xc(n)=n-5;
end;
%xc=[0,1,2,3,4,3,2,1];
n=0:1:7;
subplot(2,1,1)
stem(n,xc)
n =32; %fft點數
%n=32; %%改變fft點數
xc=fft(xc,n);
k=0:1:n-1;
subplot(2,1,2)
plot(k,abs(xc))
反三角波頻譜圖變密,兩種**譜圖沒有相似處。
(5) 用fft分別實現[(n)', 'altimg': '2f126370b787d19888f6ccb7f3417773.png', 'w':
'53', 'h': '23'}](p=8,q=2)和[(n)', 'altimg': '8e2e1b65d3a0a0e0428b8b2598271547.
png', 'w': '53', 'h': '23'}](a=0.
1,f=0.0625)的16點迴圈卷積和線性卷積。
解:clear
n=0:1:15;
p=8;
q=2;
xa=exp(-(n-p).^2/q);
a=0.1;
f=0.0625;
xb = exp(-a*n).*sin(2*pi*f*n);
n = 16;
xa=fft(xa,n);
xb=fft(xb,n);
y=xa.*xb;
y=ifft(y,n);
m=0:1:n-1
stem(m,y)
xlabel('m')
ylabel('y')
title('迴圈卷積')
南京郵電大學訊號課程實驗報告
課程實驗報告 題目 連續時間訊號的卷積 及訊號的頻域分析 學院通訊與資訊工程學院 學生姓名 班級學號 指導教師 開課學院通訊與資訊工程學院 日期實驗內容 一 連續時間訊號的卷積 問題1 用計算機算卷積是把連續訊號進行取樣,得到乙個個離散數值,然後用數值計算代替連續訊號的卷積,請推導數值計算與連續訊號...
南京郵電大學暑期實習報告
實踐是理論的延伸,要想知道梨子的味道你要親口嚐嚐才行。2012年暑期社會實踐報告書 南京市熊貓電子裝備 南京郵電大學學號姓名 摘要 迎來了作為大學生的最後乙個暑假,我如期而至地參加了暑期社會實踐活動。在注重素質教育的今天,社會實踐活動一直被視為高校培養德 智 體 美 勞全面發展的新世紀優秀人才的重要...
北京郵電大學軟體學院實驗報告
2010 2011學年第二學期實驗報告 課程名稱 分布式計算 專案名稱 注意 此處填寫實驗指導手冊中的實驗名稱專案完 姓名 學號 姓名 學號 姓名 學號 姓名 學號 姓名 學號 指導教師李晶 日期 2011年月日 一 實驗目的 說明通過本實驗希望達到的目的 二 實驗內容 說明本實驗的內容 三 實驗環...