thinkphp 网站下载企业营销策划书如何编写
用信号发生器设计一个如下信号,信号为 :y=1.5+sin(2*pi*5*x). 信号频率为5hz 采样频率为50hz,采样点数L(L=length(A) ) ,将采用数据保存为txt文件。下面是基于matlab的数据分析
clc;
clear all;
A=importdata('b.txt') ;
L=length(A);
figure
subplot(311)
plot(A);grid on; %画元数据波形
title('源数据')IIR_B=[0.9492331240211, -1.535891457913, 0.9492331240211]; %通过FDAtool设计5hz陷波滤波器,阶数为3,得到如下系数:
IIR_A=[ 1, -1.535891457913, 0.8984662480422];w01=0;
w02=0;
w03=0;y0=zeros(1,1024);
for i=1:1024w01=A(i)-IIR_A(2)*w02-IIR_A(3)*w03;y0(i)=IIR_B(1)*w01+IIR_B(2)*w02+IIR_B(3)*w03; w03=w02;w02=w01;
endsubplot(312)
axis([1,1024,0,3]); //滤波后的数据可以看待滤波后得到数据 基本只保留直流分量1.5
plot(y0,'r');FS=50;T=1/FS; //50HZ
L=length(A);
t=(0:L-1)*T;NFFT = 2^nextpow2(L)
Y = fft(A,NFFT)/L;
f = FS/2*linspace(0,1,NFFT/2+1);
subplot(313);
plot(f,2*abs(Y(1:NFFT/2+1)));grid on; //得到变换后的幅频特性图,明显看到5HZ