danadam, you wrote something in the site that got me thinking a lot about Welch. First you wrote:
"Convert to the desired units
The initial results are interpreted as power spectrum [V_rms^2]. By default they are converted to peak linear spectrum:
% Convert from power spectrum [V_rms^2] to peak linear spectrum [V_peak]<br>Y = sqrt(mag2) * sqrt(2);<br>
The conversion can be removed if you want power spectrum, or it can be changed to (rms) linear spectrum:
% Convert from power spectrum [V_rms^2] to linear spectrum [V_rms]<br>Y = sqrt(mag2);"
How do I know if my signal is in power spectrum (V_rms^2) or linear spectrum? What if my signal is in linear spectrum and Matlab and Octave reading it in power spectrum?
Also the EEG/EMG I'm doing or replicating is supposed to detect in PSD (Power Spectral Density), but I ignored it for 2 reasons. First, in this comparison:
You can see all peaks in FFT of the PSD. So I thought, why bother with PSD when one can just use FFT. Can you mention one case where you can only see signal with PSD that you can't with FFT. I read also that PSD is used if the signal is changing. In my bioamplifier, the signal is changing? so what would I miss if I just use FFT? Two months ago. I copied a subroutine for Matlab Welch. I thought about it now too because it may be the best way to renormalize the baseline of the noise.
[signal1,Fs] = audioread('bmashort.wav');
T = 1/Fs; % Sampling period
signal2 = signal1

,1);
X = double(signal2);
signal = X - mean(X);
% Define parameters for Welch's method
Fs = 44100; % Replace with your actual sampling frequency
nperseg = 7228; % Segment length (adjust as needed)
noverlap = nperseg/2; % Overlap (e.g., 50% overlap)
% Calculate the PSD using Welch's method
[power_spectrum, frequencies] = pwelch(signal, hamming(nperseg), noverlap, nperseg, Fs);
% Plot the PSD
figure;
semilogy(frequencies, power_spectrum);
xlabel('Frequency (Hz)');
ylabel('Power Spectral Density (PSD)');
title('Welch Power Spectral Density Estimate');
grid on;
Before exploring how to save the baseline and deduct it from every line in the dataset column to make it flat. First mention a case where you can see time varying signal in PSD that you can't in FFT. Btw. Octave has no command for Welch?