• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-01-04
  • 语言: Matlab
  • 标签: 加速度计  

资源简介

matlab程序,可以实现加速度转位移的过程,

资源截图

代码片段和文件信息

% clc
% clear all
% close all

fs = 100;
ts = 1/fs;

 %acc0 = importdata(‘C:\ring-gsensor\code\Ring\_Output\saveData.txt‘);
 acc0 = importdata(‘C:\ring-gsensor\code\Ring\_Output\ynew.txt‘);
acc = acc0.‘*10;
len = length(acc);

% for i = 1:len
%     if abs(acc(i))>5
%         acc(i)=0;
%     end
% end


t=[0:ts:ts*len-ts]‘; 
w=[0:2*pi/(len):2*pi-2*pi/(len)]‘; 
% f1 = 50;
% t = 0:0.001:0.1;
% acc = 2*sin(2*pi*f1*t)+1;
% len = length(t);
t=[0:ts:ts*len-ts]‘; 
w=[0:2*pi/(len):2*pi-2*pi/(len)]‘; 


figure(‘Numbertitle‘‘off‘‘Name‘‘acc&vel‘);
subplot(3 2 1);%figure(8) 
plot(t(acc))grid on;
xlabel(‘时间(ms)‘);
ylabel(‘幅值‘);
title(‘原始加速度信号‘);

acc_fft = fft(acclen);
mag=abs(acc_fft)*2/len;
f=(0:length(acc_fft)-1)‘*fs/length(acc_fft);


subplot(322);%

评论

共有 条评论