訊號的頻譜分析實驗報告

2022-03-10 17:52:25 字數 6608 閱讀 2332

實驗**號的頻譜分析

一.實驗目的

1.掌握利用fft分析連續週期,非週期訊號的頻譜,如週期,非週期方波,正弦訊號等。理解cfs,ctft與dft(fft)的關係。

2.利用fft分析離散週期,非週期訊號的頻譜,如週期,非週期方波,正弦訊號等。理解dfs,dtft與dft(fft)的關係,並討論連續訊號與離散訊號頻譜分析方法的異同。

二.實驗要求

1.編寫程式完成任意訊號數字譜分析演算法;

2.編寫實驗報告。

三.實驗內容

1.利用fft,分析並畫出頻譜,改變取樣間隔與截斷長度,分析混疊與洩漏對單一頻率成分訊號頻譜的影響。

(1)sin(100*pi*t)產生程式:

close all;

clc;

clear;

t=0:0.0025:0.5-0.0025;

f=400*t;

w0=100*pi;

y=sin(w0*t);

a=fft(y);

b=abs(a)/200;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=sin(wt)');

xlabel('t');

ylabel('y(t)');

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

subplot(313);

stem(f,d);

title('相位');

xlabel('t');

ylabel('y(t)');

混疊close all;

clc;

clear;

t=0:0.0115:0.46-0.0115;

f=(t/0.0115)*2;

w0=100*pi;

y=sin(w0*t);

a=fft(y);

b=abs(a)/40;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=sin(wt)');

xlabel('t');

ylabel('y(t)');

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

subplot(313);

stem(f,d);

title('相位');

xlabel('t');

ylabel('y(t)');

洩漏close all;

clc;

clear;

t=0:0.0025:0.5-0.0075;

f=800*t;

w0=100*pi;

y=sin(w0*t);

a=fft(y);

b=abs(a)/198;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=sin(wt)');

xlabel('t');

ylabel('y(t)');

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

subplot(313);

stem(f,d);

title('相位');

xlabel('t');

ylabel('y(t)');

(2)cos(100*pi*t);

close all;

clc;

clear;

t=0:0.0025:0.5-0.0025;

f=800*t;

w0=100*pi;

y=cos(w0*t);

a=fft(y);

b=abs(a)/200;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=cos(wt)');

xlabel('t');

ylabel('y(t)');

grid on;

hold on;

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

grid on;

hold on;

subplot(313);

stem(f,d);

title('相位');

xlabel('f');

ylabel('y(t)');

混疊close all;

clc;

clear;

t=0:0.0115:0.46-0.0115;

f=(t/0.0115)*2;

w0=100*pi;

y=cos(w0*t);

a=fft(y);

b=abs(a)/40;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=cos(wt)');

xlabel('t');

ylabel('y(t)');

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

subplot(313);

stem(f,d);

title('相位');

xlabel('t');

ylabel('y(t)');

洩漏close all;

clc;

clear;

t=0:0.0025:0.5-0.0075;

f=800*t;

w0=100*pi;

y=cos(w0*t);

a=fft(y);

b=abs(a)/198;

d=angle(a)*180/pi;

subplot(311);

plot(t,y);

title('y=cos(wt)');

xlabel('t');

ylabel('y(t)');

subplot(312);

stem(f,b);

title('振幅');

xlabel('f');

ylabel('y(t)');

subplot(313);

stem(f,d);

title('相位');

xlabel('t');

ylabel('y(t)');

2.利用fft,分析並對比方波以及半波對稱的正負方波的頻譜,改變取樣間隔與截斷長度,分析混疊與洩漏對訊號頻譜的影響。

方波正常

close all;

clc;

clear;

t=0:0.05:5-0.05;

f=40*t;

w0=2*pi;

x=square(w0*t)+1;

subplot(311);

stem(t,x);

p=fft(x);

q=abs(p)/100;

subplot(312);

stem(f,q);

title('幅頻特性曲線');

s=angle(p)*180/pi;

subplot(313);

stem(f,s);

title('相頻特性曲線');

grid on;

hold on;

方波混疊

close all

clear

clct=0:0.011:0.22-0.011;

f=(t/0.011)*2;

w0=100*pi

x=square(w0*t)

subplot(311)

stem(t,x)

p=fft(x)

q=abs(p)/20

subplot(312)

stem(f,q)

s=angle(p)*180/pi

subplot(313)

stem(t,s)

方波洩漏

close all;

clc;

clear;

t=0:0.05:5-0.25;

f=40*t;

w0=2*pi;

x=square(w0*t)+1;

subplot(311);

stem(t,x);

p=fft(x);

p1=fftshift(p);

q=abs(p1)/96;

subplot(312);

stem(f,q);

title('幅頻特性曲線');

s=angle(p)*180/pi;

subplot(313);

stem(f,s);

title('相頻特性曲線');

grid on;

hold on;

半波相對稱正常

close all;

clc;

clear;

t=0:0.1:10-0.1;

f=20*t;

w0=2*pi;

x=square(w0*t);

subplot(311);

stem(t,x);

p=fft(x);

a=0:0.1:9.9;

q=abs(p)/100;

subplot(312);

stem(f,q);

title('幅頻特性曲線');

s=angle(p)*180/pi;

subplot(313);

stem(f,s);

title('相頻特性曲線');

grid on;

hold on;

半波相對稱混疊

close all;

clc;

clear;

t=0:0.4:10-0.4;

f=5*t;

w0=2*pi;

x=square(w0*t)+1;

subplot(311);

stem(t,x);

p=fft(x);

q=abs(p)/25;

subplot(312);

stem(f,q);

title('幅頻特性曲線');

s=angle(p)*180/pi;

subplot(313);

stem(f,s);

title('相頻特性曲線');

grid on;

hold on;

半波相對稱洩漏

close all;

clc;

clear;

t=0:0.1:10-0.5;

f=20*t;

w0=2*pi;

x=square(w0*t);

subplot(311);

stem(t,x);

p=fft(x);

q=abs(p)/95;

subplot(312);

stem(f,q);

title('幅頻特性曲線');

s=angle(p)*180/pi;

subplot(313);

stem(f,s);

title('相頻特性曲線');

grid on;

hold on;

3.利用fft,分析並畫出訊號的頻譜,改變取樣間隔與截斷長度,分析混疊與洩漏對訊號頻譜的影響。

e-tu(t) 不同fs的影響

close all;

clc;

clear;

t=0:0.1:10-0.1;

t2=0:0.2:20-0.2;

y2=exp(-1*t2);

y22=fft(y2);

e=abs(y22)/10;

y1=exp(-1*t);

y=fft(y1);

a=abs(y)/10;

c=angle(y)*pi/180;

h=angle(y22)*pi/180;

f=20*t;

w=2*pi*t;

x=1./(1+j*w);

b=abs(x);

d=angle(x)*pi/180;

figure(1)

plot(f,a);

hold on;

plot(f,e,'g');

hold on;

plot(f,b,'r');

title('幅頻特性比較');

figure(2);

plot(f,c);

hold on;

plot(f,h,'g');

hold on;

plot(f,d,'r');

title('相頻特性比較');

實驗三 用FFT對訊號作頻譜分析 實驗報告

一 實驗目的與要求 學習用fft對連續訊號和時域離散訊號進行譜分析的方法,了解可能出現的分析誤差及其原因,以便正確應用fft。二 實驗原理 用fft對訊號作頻分析是學習數字訊號處理的重要內容,經常需要進行分析的訊號是模擬訊號的時域離散訊號。對訊號進行譜分析的重要問題是頻譜解析度d和分析誤差。頻譜解析...

實驗三 用FFT對訊號作頻譜分析 實驗報告

一 實驗目的與要求 學習用fft對連續訊號和時域離散訊號進行譜分析的方法,了解可能出現的分析誤差及其原因,以便正確應用fft。二 實驗原理 用fft對訊號作頻分析是學習數字訊號處理的重要內容,經常需要進行分析的訊號是模擬訊號的時域離散訊號。對訊號進行譜分析的重要問題是頻譜解析度d和分析誤差。頻譜解析...

上機實驗四 非週期訊號的頻譜分析

1.驗證試驗 1.門訊號的傅利葉變換 matlab程式 clear all clc syms t w定義符號變數 ut sym he iside t 0.5 he iside t 0.5 借助階躍函式定義門函式 subplot 2,1,1 ezplot ut hold on axis 1 1 0 1...