Filter löschen
Filter löschen

how can I get the mean of GeneralCycle?

2 Ansichten (letzte 30 Tage)
hammad albusalih
hammad albusalih am 9 Mai 2022
Beantwortet: Bhanu Prakash am 20 Okt. 2023
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

Antworten (1)

Bhanu Prakash
Bhanu Prakash am 20 Okt. 2023
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:

Community Treasure Hunt

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

Start Hunting!

Translated by