please, how can i make the plot on the x axis from 15 to 25 hertz to rest on the x axis. that is to make them start from zero. i have used detrend but, it is not working

2 views (last 30 days)
Hello can you help with the above question

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 10 Jul 2023
This is likely due to the resolution of your data. The signal is not able to capture everything, so over time, the error accumulates. There are likely techniques you can use when collecting the data to minimize this. However, since you already have the signal, I think you should try higher-order detrending. Here I picked 10 based solely on how the ouput looks
fs= 1000;
dt= 1/fs;
tspan= (0:dt:T).';
load acc.mat
yddot = acc;
ydot = cumtrapz(tspan,yddot);
ydot2 = detrend(ydot,10,"SamplePoints",tspan);
y = cumtrapz(tspan,ydot2);
Cris LaPierre
Cris LaPierre on 11 Jul 2023
Edited: John Kelly on 2 Aug 2023
Post that was deleted
Thank you very much for your response. what of the other question i asked? did you figured it out also?
It seems you already have the code written for that, but you are only capturing the final result from your nested for loops.
You can capture it easily enough. You just need to make Energy a matrix instead of a vector.
for c = 1.5:1:5.5
Energy(ii) = (trapz(tspan,c*(zdot).^2));
to something like
dcoeffs = 1.5:1:5.5;
for jj = 1:length(dcoeffs)
c = dcoeffs(jj);
Energy(ii,jj) = (trapz(tspan,c*(zdot).^2));

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!