資源簡介
獲取信號的數據文件來進行一系列處理,包括求信號的相關參數,做FFT,設計IIR濾波,畫包絡線,包絡譜。
代碼片段和文件信息
%原信號時域圖
clear?all;
clc;
load?data.mat;
fs=1000;
n=length(ydata);
t=tdata;
x=ydata;
figure(1);
subplot(211);
plot(tx);
grid?on?;
axis([0?0.1?-2?2]);
xlabel(‘時間‘);
ylabel(‘加速度‘);
title(‘Y信號時域圖‘);
%求Y信號相關參數
rms=sqrt(sum(x.^2))/n
bf=max(x);
cf=bf/rms
k=kurtosis(x)
%Y信號FFT后的波形圖
fmin=0.2;
fmax=10;
nfft=2^nextpow2(n);
ni=round(fmin*nfft/fs+1);
na=round(fmax*nfft/fs+1);
y=fft(xnfft);
a=zeros(1nfft);
a(ni:na)=y(ni:na);
a(nfft-na+1:nfft-ni+1)=y(nfft-na+1:nfft-ni+1);
Y=ifft(anfft);
y2=(real(Y(1:n)))‘;
subplot(212);
plot(tdatay2);
grid?on
xlabel(‘時間‘);
ylabel(‘加速度‘);
title(‘Y信號時域圖(濾波后)‘);
axis([0?0.1?-2?2])
?
figure(2)
f=fs*(0:n/2-1)/n;
plot(fabs(y(1:n/2)));
grid?on?
xlabel(‘頻率‘);
ylabel(‘振幅‘);
title(‘Y信號截斷頻譜圖‘)
%進行IIR帶通濾波器設計
rp=1;
rs=30;
wp=[50400];
ws=[40410];
ft=‘bandpass‘;
[Nwn]=cheb2ord(wp/(fs/2)ws/(fs/2)rprs);
[bbab]=cheby2(Nrswnf
- 上一篇:潮流分析計算
- 下一篇:gps數據最小二乘擬合分析
評論
共有 條評論