tic;
clc
clear all;
close all;
%%%仿真序列加噪声%%%
sf=160;%采样频率
n=128;%采样点数
t=(0:n-1)/sf;%时间序列
f=(0:n-1)*sf/n;%频率序列
acc=cos(2*pi*10*t)+cos(2*pi*30*t)+awgn(cos(2*pi*50*t),15);
fftAcc=fft(acc,n);
%%%频域积分%%%
df=sf/n;%频率间隔
dw=2*pi*df;%圆频率间隔
w1=0:dw:2*pi*sf/2;%正圆频率向量
w2=-2*pi*(sf/2-df):dw:-dw;%负圆频率向量
w=[w1 w2];%构建圆频率向量
dim=zeros(n,1);%构建存放积分矩阵
dim(2:n)=fftAcc(2:n)./(1i*w(2:n));
% a1=imag(dim); 实虚变换
% a2=real(dim);
% vel=a1-a2*1i; 相位变换
vel=real(ifft(dim,n)); %m->mm ;A/(2*pi*f)
%%%时域积分%%%
dt=1/200;%积分步长
temp=0;
for i=1:n
temp=acc(i)*dt+temp;
VEL(i)=temp;
end
VEL=VEL-mean(VEL);%去均值
spectrumAcc=abs(fftAcc)*2/n;
spectrumVel=abs(fft(vel))*2/n;
spectrumVEL=abs(fft(VEL))*2/n;
figure(1)
subplot(3,1,1);
plot(f(1:n/2),spectrumAcc(1:n/2));
title('original->FFT');
subplot(3,1,2);
plot(f(1:n/2),spectrumVel(1:n/2));
title('spectrumIntegral->FFT');
subplot(3,1,3);
plot(f(1:n/2),spectrumVEL(1:n/2));
title('timeDomainIntegral->FFT');
figure(2)
subplot(3,1,1)
plot(t,acc);
title('original');
subplot(3,1,2)
plot(t,vel);
title('spectrumIntegral');
axis([0 0.8 -0.02 0.02]);
subplot(3,1,3)
plot(t,VEL);
title('timeDomainIntegarl');
axis([0 0.8 -0.02 0.02]);
toc;
Integral.rar_MJ3_integarl_对比_积分_频域积分
版权申诉
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
![avatar](https://profile-avatar.csdnimg.cn/f3b7c8d80edb45ee84389e2d10b9d009_weixin_42662293.jpg!1)
局外狗
- 粉丝: 69
- 资源: 1万+
最新资源
- 2_期末网店运营报告模版.pdf
- MyBatisCodeHelperPro 3.3.2-2322 2023.2-2024.1
- 基于Python的简单的学生成绩管理程序设计(课程设计)
- jdk-8u20-windows-x64安装版本-jdk-8u301-linux-x64解压版
- 植物大战僵尸杂交版 修改阳光和冷却
- html css js网页设计ntion-model-for-开发笔记
- 数据库课程设计-processing开发笔记
- matlab画图sic-开发demo
- 数据库原理课程设计-图书馆数据库管理系统
- IEC101Sim IEC870-5-101协议仿真主站、子站 (含源码 C++Builder)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)