how can I get the mean of GeneralCycle?

1 回表示 (過去 30 日間)
hammad albusalih
hammad albusalih 2022 年 5 月 9 日
回答済み: Bhanu Prakash 2023 年 10 月 20 日
figure;
for k=1:TotalPath
myFind = find(RFHindpos >= xRounded(1,k) & RFHindpos <= xRounded(2,k));%numbers of RHS inside paths
GeneralCycle = (RFHindpos(myFind(1:end))); % the exact point of the RHS
hold all;
for t=1:length(myFind)-1
plot(Rkneeflex(GeneralCycle(t):GeneralCycle(t+1))); % the points where cycles start and end
sgtitle('Gait Cycles')
% plot(meanofcycCellarray)
end
GeneralCycleCellArray{k}=GeneralCycle; % where you store all generalcycles so you dont loose them after each loop
meanofcyc = [t;(Rkneeflex(GeneralCycle(k):GeneralCycle(k+1)))];
plot(meanofcyc,'g')
end

回答 (1 件)

Bhanu Prakash
Bhanu Prakash 2023 年 10 月 20 日
Hi Hammad,
I understand that you want to calculate the mean of the ‘GeneralCycle’ array.
To calculate the mean of an array, you can use the ‘mean’ function in MATLAB as shown in the edited part of the code below:
GeneralCycleCellArray{k} = GeneralCycle;
% Calculate the mean of GeneralCycle
meanofcyc = mean(GeneralCycle);
% Store the mean value in the cell array
meanofcycCellArray{k} = meanofcyc;
plot(meanofcyc, 'g');
The above code calculates the mean of the GeneralCycle and stores it in a cell array ‘meanofcycCellArray’. You can plot the mean using the plot function.
For more information on the ‘mean’ function, refer to the following documentation:

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by