• 大小: 3KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-04-21
  • 语言: Matlab
  • 标签: 斯窗函数  MATLAB  

资源简介

令x(n)=5exp(j*0.15*n*n)+6exp(j*300n-j*0.15*n*n) ,w(n)为高斯窗函数。试用matlab软件,取不同长度的窗函数,分别求x(n)离散短时傅里叶变换,并进行信号重构。

资源截图

代码片段和文件信息

% Main Function
%%
clear;
clc;
%%
% 画出原始信号;
r = 1; L=512;n =1:r:L;
x = 5*exp(j*(0.15*n.^2))+6*exp(j*(300*n-0.15*n.^2));
figure(1);plot(nx);
xlabel(‘n‘); ylabel(‘x‘);xlim([0512]);
title(‘原始信号X‘);
%%
% 创建四个不同宽度的高斯窗口默认singma=2.5
N1=7; w1=gausswin(N1);         
N2=15;w2=gausswin(N2);        
N3=21;w3=gausswin(N3);        
N4=31;w4=gausswin(N4);         
%%
% 画出不同宽度的高斯窗口函数.
figure(2)
subplot(221);plot(1:N1w1);title([‘宽度N1=‘ num2str(N1)]) ;xlim([032]);
subplot(222);plot(1:N2w2);title([‘宽度N2=‘ num2str(N2)]) ;xlim([032]);
subplot(223);plot(1:N3w3);title([‘宽度N3=‘ num2str(N3)]) ;xlim([032]);
subplot(224);plot(1:N4w4);title([‘宽度N4=‘ num2str(N4)]) ;xlim([032]);
%%
% 用不同的窗口函数对x进行短时傅里叶变换
z=x‘;
[tfr1t1f1]=tfrstft(z1:LLw1); 
[tfr2t2f2]=tfrstft(z1:LLw2); 
[tfr3t3f3]=tfrstft(z1:LLw3); 
[tfr4t4f4]=tfrstft(z1:LLw4); 
%%
% % 画出不同宽度窗口函数的时频分析2维与3维图.
figure(3)
subplot(221);imagesc(abs(tfr1)); xlabel(‘t‘);ylabel(‘ f‘);xlim([0512]);title([‘宽度N1=‘ num2str(N1)]); 
subplot(222);imagesc(abs(tfr2)); xlabel(‘t‘);ylabel(‘ f‘);xlim([0512]);title([‘宽度N2=‘ num2str(N2)]); 
subplot(223);imagesc(abs(tfr3)); xlabel(‘t‘);ylabel(‘ f‘);xlim([0512]);title([‘宽度N3=‘ num2str(N3)]); 
subplot(224);imagesc(abs(tfr4)); xlabel(‘t‘);ylabel(‘ f‘);xlim([0512]);title([‘宽度N4=‘ num2str(N4)]);
figure(4)
subplot(221);mesh(t1f1abs(tfr1));xlabel(‘t‘);ylabel(‘ f‘);zlabel(‘ A‘);xlim([0512]);title([‘宽度N1=‘ num2str(N1)]); 
subplot(222);mesh(t2f2abs(tfr2));xlabel(‘t‘);ylabel(‘ f‘);zlabel(‘ A‘);xlim([0512]);title([‘宽度N2=‘ num2str(N2)]); 
subplot(223);mesh(t3f3abs(tfr3));xlabel(‘t‘);ylabel(‘ f‘);zlabel(‘ A‘);xlim([0512]);title([‘宽度N3=‘ num2str(N3)]); 
subplot(224);mesh(t4f4abs(tfr4));xlabel(‘t‘);ylabel(‘ f‘);zlabel(‘ A‘);xlim([0512]);title([‘宽度N4=‘ num2str(N4)]);
%%
% 进行短时傅里叶反变换
s1=tfristft(tfr11:Lw1);
s2=tfristft(tfr21:Lw2);
s3=tfristft(tfr31:Lw3);
s4=tfristft(tfr41:Lw4);
%%
% 画出重构信号与原始信号的差图
figure(5)
subplot(221);plot(nabs(s1-x‘)); xlabel(‘n‘);ylabel(‘△‘);xlim([0512]);title([‘宽度N1=‘ num2str(N1)]);
subplot(222);plot(nabs(s2-x‘)); xlabel(‘n‘);ylabel(‘△‘);xlim([0512]);title([‘宽度N2=‘ num2str(N2)]);
subplot(223);plot(nabs(s3-x‘)); xlabel(‘n‘);ylabel(‘△‘);xlim([0512]);title([‘宽度N3=‘ num2str(N3)]);
subplot(224);plot(nabs(s4-x‘)); xlabel(‘n‘);ylabel(‘△‘);xlim([0512]);title([‘宽度N4=‘ num2str(N4)]);




 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .CA....      2399  2012-12-13 19:28  tfristft.m

    .CA....      2572  2012-12-13 19:28  tfrstft.m

    .CA....      2556  2012-12-13 19:28  my_tfrstft2.m

----------- ---------  ---------- -----  ----

                 7527                    3


评论

共有 条评论