wigner.m

来自「这是一个基于matlab维纳滤波的m程序」· M 代码 · 共 40 行

M
40
字号
function [F,T,AF]=wigner(x,fs)
N=floor(length(x));Ts=1/fs;
lin=zeros(1,N);
x_he=[lin ,x,lin];
%x_he=x;
x_ge=conj(x_he);

 Js=0;
 while 2^Js<2*N
  Js=Js+1;
  end
fft_num=2^Js;
%N=length(x);

AF=zeros(N,fft_num);%temp=zeros(1,N);
% x_las=zeros(N,2*N);
for n=1:N
for t=0:N-1
%if (i-th>=0)& ( i+th>=0) & ( i+th<=N) & ( i-th<=N)
    %x_las=x;
     %for t=1:N
     x_las1(t+1)=2*x_ge(N+n-t)*x_he(n+t+N);
    % x_las=x_las+x;
    end
   %x_las4=x_las1;
  x_las2=conj(fliplr(x_las1));
  x_las3=[x_las1,x_las2];
   temp=fft(x_las3 ,fft_num);
   temp=fftshift(temp);
   AF(n,:)=temp;

end
%坐标恢复
f_zuobiao=(((1:fft_num)-fft_num/2)/fft_num*fs);
t_zuobiao=((1:N)*Ts);
[F,T]=meshgrid(f_zuobiao,t_zuobiao);
%绘图
subplot(2,2,3);mesh(F,T,real(AF));
subplot(2,2,4);contour(F,T,abs(AF));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?