文档详情

实验二用FFT对信号作频谱分析.doc

发布:2016-11-04约5.66千字共10页下载文档
文本预览下载声明
实验二 用FFT对信号作频谱分析 实验目的 学习用FFT对连续信号和时域离散信号进行谱分析的方法,了解可能出现的分析误差及其原因,以便正确应用FFT。 二、实验步骤及内容 对以下序列进行谱分析: x1(n)=R4(n) x2(n)= x3(n)= 选择FFT的变换区间N为8和16两种情况进行频谱分析。分别打印其幅频特性曲线,并进行对比、分析和讨论。 (1) 程序: close all;clear all x1=[1,1,1,1]; %产生矩形信号R4(n) x8k=fft(x1,8); %求系统8位FFT变换 x16k=fft(x1,16); %求系统8位FFT变换 y1=abs(x8k); %8点幅频特性 y2=abs(x16k); %16点幅频特性 y21= angle(x8k); %8点相频特性 y22= angle(x16k); %16点相频特性 subplot(2,2,1); stem(y1,.); title(8点幅频特性); subplot(2,2,2); stem(y21,.); title(8点相频特性); subplot(2,2,3); stem(y2,.); title(16点幅频特性); subplot(2,2,4); stem(y22,.); title(16点相频特性); grid on; (2) 程序: close all;clear all n1=0:3; x1=n1+1; n2=4:7; x2=8-n2; x=[x1,x2]; x8k=fft(x,8); %求系统8位FFT变换 x16k=fft(x,16); %求系统8位FFT变换 y1=abs(x8k); %8点幅频特性 y2=abs(x16k); %16点幅频特性 y21= angle(x8k); %8点相频特性 y22= angle(x16k); %16点相频特性 subplot(2,2,1); stem(y1,.); title(8点幅频特性); subplot(2,2,2); stem(y21,.); title(8点相频特性); subplot(2,2,3); stem(y2,.); title(16点幅频特性); subplot(2,2,4); stem(y22,.); title(16点相频特性); grid on; %产生矩形信号R4(n) x8k=fft(x1,8); %求系统8位FFT变换 x16k=fft(x1,16); %求系统8位FFT变换 y1=abs(x8k); %8点幅频特性 y2=abs(x16k); %16点幅频特性 y21= angle(x8k); %8点相频特性 y22= angle(x16k); %16点相频特性 subplot(2,2,1); stem(y1,.); title(8点幅频特性); subplot(2,2,2); stem(y21,.); title(8点相频特性); subplot(2,2,3); stem(y2,.); title(16点幅频特性); subplot(2,2,4); stem(y22,.); title(16点相频特性); grid on; (3) 程序: close all;clear all n1=0:3; x1=4-n1; n2=4:7; x2=n2-3; x=[x1,x2]; x8k=fft(x,8); %求系统8位FFT变换 x16k=fft(x,16); %求系统8位FFT变换 y1=abs(x8k); %8点幅频特性 y2=abs(x16k); %16点幅频特性 y21= angle(x8k); %8点相频特性 y22= angle(x16k); %16点相频特性 subplot(2,2,1); stem(y1,.); title(8点幅频特性); subplot(2,2,2); stem(y21,.); title(8点相频特性); subplot(2,2,3); stem(y2,.); title(16点幅频特性); subplo
显示全部
相似文档