matlab课程设计实验八.docx
- 文档编号:7105364
- 上传时间:2023-01-17
- 格式:DOCX
- 页数:15
- 大小:534.88KB
matlab课程设计实验八.docx
《matlab课程设计实验八.docx》由会员分享,可在线阅读,更多相关《matlab课程设计实验八.docx(15页珍藏版)》请在冰豆网上搜索。
matlab课程设计实验八课程设计实验八MATLAB与信号处理实验八题1周期信号频谱分析题目:
给定输入信号x(n)为一周期信号,含基波及若干次谐波分量。
要求:
1、给出信号基波频率及谐波个数2、基波及各个谐波信号的相位和幅值clearclcA=0.250.50.25;f=124;fi=00.5*pi0.75*pi;N=59;fs=10;t=(1:
N)./fs;x_n=A
(1).*sin(2*pi*f
(1)*t+fi
(1)+A
(2).*sin(2*pi.*f
(2)*t+fi
(2)+A(3).*sin(2*pi.*f(3)*t+fi(3);save(Signal.mat,x_n)程序:
fs=10;N=10;n=1:
N;t=n/fs;x=0.25*sin(2*pi*t)+0.5*sin(2*pi*2*t)+0.25*sin(2*pi*4*t);figure
(1)subplot(211);plot(x);grid;y=fft(x,N);mag=abs(y);k=0:
length(y)-1;f=fs/N*k;subplot(212);plot(f,mag);xlabel(Frequence(Hz);ylabel(Magnitude);grid;title(对周期信号的一个周期进行频谱分析)figure
(2)x=xxxxxxx;figure
(2)subplot(211);plot(x);grid;N=length(x)y=fft(x,N);mag=abs(y);k=0:
length(y)-1;f=fs/N*ksubplot(212);plot(f,mag);xlabel(Frequence(Hz);ylabel(Magnitude);grid;title(对周期信号的多个周期进行频谱分析)题2数字滤波器设计题目:
已知输入信号x(t)=0.6sin(200t)+sin(400t)+0.3sin(800t)。
要求:
通过MATLAB编程设计一1)低通滤波器,输出信号x(t)的最低频率成份.2)高通滤波器,输出信号x(t)的最高频率成份.3)带通滤波器,输出信号x(t)的中间频率成份.4)带阻滤波器,输出信号x(t)的最低+最高频率成份.(Rp=1dB,Rs=16dB,Fs=3倍最高频率,截止频率、滤波器设计方法及类型自己选择.)%输入信号X(t)Fs=1200;N=2048;n=0:
N;t=n/Fs;x=0.6*sin(200*pi*t)+sin(400*pi*t)+0.3*sin(800*pi*t);y=fft(x,N);mag=abs(y);k=0:
length(y)-1;f=Fs/N*k;figure
(1)plot(f,mag);xlabel(Frequence(Hz);ylabel(Magnitude);title(N=2048);grid;%1)低通数字滤波器设计Wp=0.12*pi;Ws=0.2*pi;rp=1;rs=16;Fs=1200;%数字滤波器指标n,wn=buttord(Wp/pi,Ws/pi,rp,rs);b,a=butter(n,wn);figure
(2)freqz(b,a,256);title(数字底通滤波器的幅频相频特性图);y1=filter(b,a,x);y=fft(y1,N);mag=abs(y);k=0:
length(y)-1;f=Fs/N*k;figure(3)plot(f,mag);grid;title(输出信号x(t)的最低频率成份)%2)高通数字滤波器设计Wp=0.6*pi;Ws=0.45*pi;rp=1;rs=16;Fs=1200;%数字滤波器指标n,wn=buttord(Wp/pi,Ws/pi,rp,rs);b,a=butter(n,wn,high);figure(4)freqz(b,a,256);title(数字高通滤波器的幅频相频特性图);y1=filter(b,a,x);y=fft(y1,N);mag=abs(y);k=0:
length(y)-1;f=Fs/N*k;figure(5)plot(f,mag);grid;title(输出信号x(t)的最高频率成份)%3带通数字滤波器设计Wp=0.2*pi0.45*pi;Ws=0.12*pi0.6*pi;rp=1;rs=30;Fs=1200;%数子滤波器指标n,wn=buttord(Wp/pi,Ws/pi,rp,rs);b,a=butter(n,Wp/pi,bandpass);figure(6)freqz(b,a,256);title(数字带通滤波器的幅频相频特性图);y1=filter(b,a,x);y=fft(y1,N);mag=abs(y);k=0:
length(y)-1;f=Fs/N*k;figure(7)plot(f,mag);grid;title(输出信号x(t)的中间频率成份)%4带阻数字滤波器设计Ws=0.2*pi0.45*pi;Wp=0.12*pi0.6*pi;rp=1;rs=30;Fs=1200;%数子滤波器指标n,wn=buttord(Wp/pi,Ws/pi,rp,rs);b,a=butter(n,Ws/pi,stop);figure(8)freqz(b,a,256);title(数字带阻滤波器的幅频相频特性图);y1=filter(b,a,x);y=fft(y1,N);mag=abs(y);k=0:
length(y)-1;f=Fs/N*k;figure(9)plot(f,mag);grid;title(输出信号x(t)的最低加最高频率成份)题3语音信号采集与处理初步题目:
1语音信号的采集2语音信号的频谱分析3设计数字滤波器和画出频率响应4用滤波器对信号进行滤波5比较滤波前后语音信号的波形及频谱6回放和存储语音信号x,fs,bits=wavread(wangrunnan.wav);wavplay(x);pause(3);wavplay(x,11025);pause(3)wavplay(x,44100);X=fft(x,4096);magX=abs(X);angX=angle(X);figure
(1)subplot(221);plot(x);title(原始音频信号波形);subplot(222);plot(X);title(原始音频信号频谱);subplot(223);plot(magX);title(原始音频信号幅值);subplot(224);plot(angX);title(原始音频信号相位);%N阶高通数字滤波器pause(5)x=wavread(wangrunnan.wav);sound(x);N=5;wc=0.3;b,a=butter(N,wc,high);X=fft(x);figure
(2)subplot(321);plot(x);title(滤波前信号的波形);subplot(322);plot(X);title(滤波前信号的频谱);y=filter(b,a,x);wavwrite(y,wangrunnan1.wav);wavplay(y)Y=fft(y);subplot(323);plot(y);title(IIR滤波后信号的波形);subplot(324);plot(Y);title(IIR滤波后信号的频谱);z=fftfilt(b,x);wavwrite(z,wangrunnan2.wav);wavplay(z)Z=fft(z);subplot(325);plot(z);title(FIR滤波后信号的波形);subplot(326);plot(Z);title(FIR滤波后信号的频谱);%N阶低通数字滤波器pause(5)x=wavread(wangrunnan.wav);sound(x);X=fft(x);figure(3)subplot(321);plot(x);title(滤波前信号的波形);subplot(322);plot(X);title(滤波前信号的频谱);N=5;wc=0.3;b,a=butter(N,wc);y=filter(b,a,x);wavwrite(y,wangrunnan3.wav);wavplay(y)Y=fft(y);subplot(323);plot(y);title(IIR滤波后信号的波形);subplot(324);plot(Y);title(IIR滤波后信号的频谱);z=fftfilt(b,x);wavwrite(z,wangrunnan4.wav);wavplay(z)Z=fft(z);subplot(325);plot(z);title(FIR滤波后信号的波形);subplot(326);plot(Z);title(FIR滤波后信号的频谱);%2N阶带通数字滤波器pause(5)x=wavread(wangrunnan.wav);sound(x);N=5;wc=0.3,0.6;b,a=butter(N,wc,bandpass);X=fft(x);figure(4)subplot(321);plot(x);title(滤波前信号的波形);subplot(322);plot(X);title(滤波前信号的频谱);y=filter(b,a,x);wavwrite(y,wangrunnan5.wav);wavplay(y)Y=fft(y);subplot(323);plot(y);title(IIR滤波后信号的波形);subplot(324);plot(Y);title(IIR滤波后信号的频谱);z=fftfilt(b,x);wavwrite(z,wangrunnan6.wav);wavplay(z)Z=fft(z);subplot(325);plot(z);title(FIR滤波后信号的波形);subplot(326);plot(Z);title(FIR滤波后信号的频谱);%2N阶带阻数字滤波器pause(5)x=wavread(wangrunnan.wav);sound(x);N=5;wc=0.2,0.7;b,a=butter(N,wc,stop);X=fft(x);figure(5)subplot(321);plot(x);title(滤波前信号的波形);subplot(322);plot(X);title(滤波前信号的频谱);y=filter(b,a,x);wavwrite(y,wangrunnan7.wav);wavplay(y)Y=fft(y);subplot(323);plot(y);title(IIR滤波后信号的波形);subplot(324);plot(Y);title(IIR滤波后信号的频谱);z=fftfilt(b,x);wavwrite(z,wangrunnan8.wav);wavplay(z)Z=fft(z);subplot(325);plot(z);title(FIR滤波后信号的波形);subplot(326);plot(Z);title(FIR滤波后信号的频谱);
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 课程设计 实验
![提示](https://static.bdocx.com/images/bang_tan.gif)