フィルターのクリア

How to calculate gradient and correlation coefficients with moving window in matlab?

2 ビュー (過去 30 日間)
Muhammad Hammad Malik
Muhammad Hammad Malik 2021 年 1 月 27 日
編集済み: Muhammad Hammad Malik 2021 年 1 月 27 日
I am working on pedestrian step detection algorithm (acceleration data), i need to calculate statistical features from my filtered signal not raw data. I have already calculated mean, var and std and now i want to calculate correlation coefficients and gradient from filtered data. My filter data is of 1x37205 double. I calculated these features using for loop with moving window size=2samples and 50% overlap of previous window. Below i am attaching the code i tried with to calculate. But when i run this for corrcoef it gives 1's as output for whole data and for gradient it gives error "Assignment has more non-singleton rhs dimensions than non-singleton subscripts". I am unable to understand well. Could some one suggest me or provide any code help in matlab and/or how can i work on that?
windowsize=2;
%%C is used for corrcoef and G for gradient. %%Data_filtered is caclulated
%%from acceleration xyz.
function [C, G] = features(Data_filtered, window)
C=zeros(length(Data_filtered),1);
G=zeros(length(Data_filtered),1);
for i=window:(length(Data_filtered))
C(i,1)=corrcoef(Data_filtered(i+1-window:i));
end;
for i=window:(length(Data_filtered))
G(i,1)=gradient(Data_filtered(i+1-window:i));
end;
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by