數字訊號處理實驗二

2023-01-07 04:39:06 字數 5198 閱讀 9128

實驗二q2-1

n = 0:100;

s1 = cos(2*pi*0.05*n);

s2 = cos(2*pi*0.47*n);

x = s1+s2;

m = input('濾波器所需長度=');

num = ones(1,m);

y = filter(num,1,x)/m;

clf;

subplot(2,2,1);

plot(n, s1);

axis([0, 100, -2, 2]);

xlabel('時間序號n'); ylabel('振幅');

title('訊號#1');

subplot(2,2,2);

plot(n, s2);

axis([0, 100, -2, 2]);

xlabel('時間序號n '); ylabel('振幅');

title('訊號#2');

subplot(2,2,3);

plot(n, x);

axis([0, 100, -2, 2]);

xlabel('時間序號n '); ylabel('振幅');

title('輸入訊號');

subplot(2,2,4);

plot(n, y);

axis([0, 100, -2, 2]);

xlabel('時間序號n '); ylabel('振幅');

title('輸入訊號');

axis;

輸入的頻率分量被離散時間系統抑制

q2-2

線性時不變系統發生改變後,輸入x的頻率會發生改變。

q2-5

clf;

n = 0:200;

x = cos(2*pi*0.05*n);

x1 = [x 0 0];

x2 = [0 x 0];

x3 = [0 0 x];

y = x2.*x2-x1.*x3;

y = y(2:202);

subplot(2,1,1)

plot(n, x)

xlabel('時間序號n');ylabel('振幅');

title('輸入訊號')

subplot(2,1,2)

plot(n,y)

xlabel('時間序號n n');ylabel('振幅');

title('輸出訊號');

當輸入訊號為cos(2*pi*0.1*n)時;

當輸入訊號為cos(2*pi*0.01*n)時;

當輸入訊號頻率大於一定值時,輸出訊號的最低幅值為零。

q2-7

clf;

n = 0:40;

a = 2;b = -3;

x1 = cos(2*pi*0.1*n);

x2 = cos(2*pi*0.4*n);

x = a*x1 + b*x2;

num = [2.2403 2.4908 2.2403];

den = [1 -0.4 0.75];

ic = [0 0];

y1 = filter(num,den,x1,ic);

y2 = filter(num,den,x2,ic);

y = filter(num,den,x,ic);

yt = a*y1 + b*y2;

d = y - yt;

subplot(3,1,1)

stem(n,y);

ylabel('振幅');

title('加權輸入: a \cdot x_[n] + b \cdot x_[n]');

subplot(3,1,2)

stem(n,yt);

ylabel('振幅');

title('加權輸出: a \cdot y_[n] + b \cdot y_[n]');

subplot(3,1,3)

stem(n,d);

xlabel('時間序號n');ylabel('振幅');

title('差訊號');

兩個序列並不相等,該系統不是線性系統。

q2-9

初始條件設為ic = [3 10];

系統在一定n之後趨於線性系統。

q2-12

clf;

n = 0:40; d = 10;a = 3.0;b = -2;

x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);

xd = [zeros(1,d) x];

num = [2.2403 2.4908 2.2403];

den = [1 -0.4 0.75];

ic = [0 0];

y = filter(num,den,x,ic);

yd = filter(num,den,xd,ic);

d = y - yd(1+d:41+d);

subplot(3,1,1)

stem(n,y);

ylabel('振幅');

title('輸出y[n]'); grid;

subplot(3,1,2)

stem(n,yd(1:41));

ylabel('振幅');

title(['由於延時輸入x[n', num2str(d),']']); grid;

subplot(3,1,3)

stem(n,d);

xlabel('時間序號n'); ylabel('振幅');

title('差值訊號'); grid;

這兩個序列是延時的關係,該系統是時不變系統。

q2-15

初始條件設為ic = [3 10];

該系統不是時不變系統。

q2-19

clf;

n = 40;

num = [2.2403 2.4908 2.2403];

den = [1 -0.4 0.75];

y = impz(num,den,n);

stem(y);

xlabel('時間序號n'); ylabel('振幅');

title('衝激響應'); grid;

q2-23

clf;

x = [1 zeros(1,40)];

n = 0:40;

den = [1 1.6 2.28 1.325 0.68];

num = [0.06 -0.19 0.27 -0.26 0.12];

y = filter(num,den,x);

num1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8];

num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];

y1 = filter(num1,den1,x);

y2 = filter(num2,den2,y1);

d = y - y2;

subplot(3,1,1);

stem(n,y);

ylabel('振幅');

title('四階實現的輸出'); grid;

subplot(3,1,2);

stem(n,y2)

ylabel('振幅');

title('級聯實現的輸出'); grid;

subplot(3,1,3);

stem(n,d)

xlabel('時間序號m');ylabel('振幅');

title('差值訊號'); grid;

y[n]和y2[n]是不相等的。

q2-25

ic1:[2 2 5 4]

ic2:[0 2 ]

ic3:[3 5]

q2-28

clf;

h = [3 2 1 -2 1 0 -4 0 3];

x = [1 -2 3 -4 3 2 1];

y = conv(h,x);

n = 0:14;

subplot(2,1,1);

stem(n,y);

xlabel('時間序號n'); ylabel('振幅');

title('卷積所得輸出'); grid;

x1 = [x zeros(1,8)];

y1 = filter(h,1,x1);

subplot(2,1,2);

stem(n,y1);

xlabel('時間序號n '); ylabel('振幅');

title('濾波生成輸出'); grid;

沒有差別,對x補零可以減少,增加抽樣點,滿足點數對應。

q2-32

clf;

num = [1 -0.8]; den = [1 1.5 0.9];

n = 200;

h = impz(num,den,n+1);

parsum = 0;

for k = 1:n+1;

parsum = parsum + abs(h(k));

if abs(h(k)) < 10^(-6), break, end

endn = 0:n;

stem(n,h)

xlabel('時間序號n'); ylabel('振幅');

disp('值 =');disp(abs(h(k)));

對應的離散時間系統差分方程是:y[n]+1.5y[n-1]+0.9y[n-2]=x[n]-0.8x[n-1],該系統穩定

取較大n值1000

q2-34

clf;

n = 0:299;

x1 = cos(2*pi*10*n/256);

x2 = cos(2*pi*100*n/256);

x = x1+x2;

num1 = [0.5 0.27 0.77];

y1 = filter(num1,1,x);

den2 = [1 -0.53 0.46];

num2 = [0.45 0.5 0.45];

y2 = filter(num2,den2,x);

subplot(2,1,1);

plot(n,y1);axis([0 300 -2 2]);

ylabel('振幅');

title('系統輸出#1'); grid;

subplot(2,1,2);

plot(n,y2);axis([0 300 -2 2]);

xlabel('時間序號n『); ylabel('振幅');

title('系統輸出#2'); grid;

第二個濾波器更好的抑制輸入訊號的高頻分量。

數字訊號處理實驗

一 實驗目的 研究不同型別的窗函式,研究一些不同的方法來測試窗函式的效能 專注於有關窄帶訊號的幾個不同的情形。二 實驗原理 訊號是無限長的,而在進行訊號處理時只能採用有限長訊號,所以需要將訊號 截斷 在訊號處理中,截斷 被看成是用乙個有限長的 視窗 看無限長的訊號,或者從分析的角度是無限長的訊號x ...

數字訊號處理實驗

班級 08050742 姓名 劉曉華 學號 41 實驗一頻譜分析與取樣定理 一 實驗目的 1 觀察模擬訊號經理想取樣後的頻譜變化關係。2 驗證取樣定理,觀察欠取樣時產生的頻譜混疊現象 3 加深對dft演算法原理和基本性質的理解 4 熟悉fft演算法原理和fft的應用 二 實驗原理 根據取樣定理,對給...

數字訊號處理實驗

利用fft實現快速卷積 姓名 田昕煜 學號 13081405 班級 通訊四班 指導教師 周爭 一 實驗原理 應用fft實現數字濾波器實際上就是用fft來快速計算有限長度序列的線性卷積。這種方法就是先將輸入訊號x n 通過fft變換為它的頻譜取樣值x k 然後再和fir的頻響取樣值h k 相乘,h k...