How to normalise segregated surface emg signals into the same number of data points?
4 件のコメント
採用された回答
その他の回答 (1 件)
Hi @Renee Wurfel ,
To achieve the normalization of SEMG cycles while preserving the integrity of the signals, you can utilize interpolation techniques. This method will allow you to resample each cycle to a predetermined number of data points without distorting the signal characteristics. Here’s how you can modify your existing code to incorporate these steps:
% Assuming BB_Cycles contains your segmented SEMG cycles num_cycles = length(BB_Cycles); target_length = 1000; % Set your desired target length for normalization normalized_cycles = zeros(num_cycles, target_length); % Preallocate normalized cycles
% Interpolation for each cycle for i = 1:num_cycles original_cycle = BB_Cycles{i}; original_length = length(original_cycle);
% Create a time vector for the original cycle original_time = linspace(0, 1, original_length); % Normalize time between 0 and 1
% Create a new time vector for the target length new_time = linspace(0, 1, target_length);
% Interpolate using linear method (you can use 'spline' for smoother results) normalized_cycles(i, :) = interp1(original_time, original_cycle, new_time, 'linear'); end
% Calculate average SEMG signal across all normalized cycles average_SEMG = mean(normalized_cycles, 1);
% Plotting the average SEMG signal figure; plot(linspace(0, 1, target_length), average_SEMG); title('Average SEMG Signal Across Cycles'); xlabel('Normalized Time'); ylabel('Amplitude'); grid on;
% You may also want to visualize individual normalized cycles figure; hold on; for i = 1:num_cycles plot(linspace(0, 1, target_length), normalized_cycles(i, :)); end title('Normalized SEMG Cycles'); xlabel('Normalized Time'); ylabel('Amplitude'); legend(arrayfun(@(x) sprintf('Cycle %d', x), 1:num_cycles, 'UniformOutput', false)); hold off;
In addition to this code, the choice of interpolation method (linear vs. spline) can affect the smoothness of your normalized signals. Spline interpolation tends to provide smoother results but may introduce artifacts if not handled carefully. So, make sure that the normalization process does not introduce significant distortion in your SEMG signals. I will advise to visualize both individual cycles and their averages post-normalization. After obtaining the average signal, consider performing statistical analyses to evaluate variability among different cycles or conditions.
2 件のコメント
参考
カテゴリ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!