- clc,clear,close all
- warning off
- %% 随机分析一个信号
- load('data.mat') % 加载数据
- x = RC304(:, 2); % 信号
- Ts = 7.8125e-5; % 采样时间
- Fs = 1/Ts; % 采样频率
- %% 小波滤波
- [thr,sorh,keepapp,crit] = ddencmp('cmp','wp',x);
- [xc,wpt,perf0,perfl2] = wpdencmp(x,sorh,3,'db2',crit,thr,keepapp);
- [c,l] = wavedec(xc,3,'db1'); % 多尺度小波分解
- %% FFT分析
- L = length(c);
- NFFT = 2^nextpow2(L); % Next power of 2 from length of y
- c_fft = fft(c, NFFT)/L;
- figure(1)
- plot( Fs/2*linspace(0, 1, NFFT/2+1), abs( c_fft(1:NFFT/2+1) ) )
复制代码
|