フィルターのクリア

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

1 回表示 (過去 30 日間)
Hello can you help with the above question
  9 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 7 月 18 日
We are several steps removed from the original question. I suggest asking a new question in the forum.
Matthew Worker
Matthew Worker 2023 年 7 月 24 日
some of the data i dropped are from an ongoing research, which i should not have dropped

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 7 月 10 日
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;
T=7;
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);
plot(tspan,ydot2,tspan,y)
  2 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 7 月 10 日
編集済み: Cris LaPierre 2023 年 7 月 10 日
Another approach might be to smooth your signal and then subtract the smoothed signal from the raw signal.
fs= 1000;
T=7;
dt= 1/fs;
tspan= (0:dt:T).';
load acc.mat
yddot = acc;
ydot_raw = cumtrapz(tspan,yddot);
smoothedData = smoothdata(ydot_raw,"lowess","SmoothingFactor",0.125);
ydot = ydot_raw - smoothedData;
y = cumtrapz(tspan,ydot);
plot(tspan,ydot,tspan,y)
Cris LaPierre
Cris LaPierre 2023 年 7 月 11 日
編集済み: John Kelly 2023 年 8 月 2 日
Post that was deleted
Thank you very much for your response. what of the other question i asked? did you figured it out also?
______________________________________________________________________
Response
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.
Change
for c = 1.5:1:5.5
...
Energy(ii) = (trapz(tspan,c*(zdot).^2));
end
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));
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by