Welch PSD for tremor has very high frequency
1 view (last 30 days)
Show older comments
I am trying to compute a PSD using the Welch Method on a tremor signal from a mouse. usually these tremors occur between 1Hz-15Hz but after doing various PSDs and FFTs nothing will come back with a dB/Hz within the range (usualy 50+) which is not only unusual but almost impossible. I have never done a PSD or FFT before so I taught myself from scratch. Can anyone help me figure out what I am doing wrong? here is my Matlab code:
% Load and extract signal and time from CSV
data = readmatrix('M2_C2823722_MatLab.csv');
time = data(:,1);
signal = detrend(data(:,2) - mean(data(:,2))); % Demean and detrend in one line
% Sampling frequency
fs = 1 / mean(diff(time));
% Apply Hamming window directly
signal = signal .* hamming(length(signal)); % No transpose needed
% Compute PSD with Welch method
window = 3000; % 3-second segments
noverlap = 1500; % 1.5-second overlap
[pxx, f] = pwelch(signal, window, noverlap, [], fs);
% Plot PSD
figure;
plot(f, 10*log10(pxx));
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');
title('PSD Estimate: 3-Second Segments, 1.5s Overlap');
grid on;
% Save results
writetable(table(f, pxx), 'psd_resultsM2_3722.csv');
saveas(gcf, 'm2_3722.png');
4 Comments
Answers (0)
See Also
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!