Velocity from acceleration data
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all,
I have an acceleration data from accelerometers. I want to get velocity from the data by integrate it using matlab. Here my coding :-
%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'})
and the plot is
my question are:-
1) When i run the coding below warning is appear
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
is my result valid???
2) What the velocity value from the graph?
Thank you.
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!