加速度数据的速度

时间:2015-06-29 02:06:54

标签: matlab

我测量了加速度计的加速度数据。我想通过使用MATLAB集成它来从数据中获取速度。这是我的代码:

%clear
clc;

%Create a baseline sinusoidal signal
ch1_100mss = ch1_100ms xdata = ch1_100mss; y0 = sin(xdata);

%Add noise to the signal
noise = 2*y0.*randn(size(y0)); % Response-dependent
ydata = y0 + noise; % Gaussian noise

%Fit the noisy data with a custom sinusoidal model
f = fittype('a*sin(b*x)'); fit1 = fit(xdata,ydata,f,'StartPoint',[1 1]);

%Find the integral of the fit at the predictors
int = integrate(fit1,xdata,0);

%Plot the data, the fit, and the integral
subplot(2,1,1) plot(fit1,xdata,ydata) % cfit plot method subplot(2,1,2) plot(xdata,int,'m') % double plot method grid on legend('integral') plot(fit1,xdata,ydata,{'fit','integral'})

运行代码时,会出现以下警告

Warning: Minimum step size reached; singularity possible.
> In quad at 103
  In cfit.integrate at 42
  In integration at 23

Warning: Minimum step size reached; singularity possible.
> In quad at 103
  In cfit.integrate at 40
  In cfit.plot at 138
  In integration at 33

Warning: Minimum step size reached; singularity possible.
> In quad at 103
  In cfit.integrate at 42
  In cfit.plot at 138
  In integration at 33

我的结果是否有效?

0 个答案:

没有答案