Estimate the psd of a signal
Ältere Kommentare anzeigen
In the following code I calculate the PSD of my signal, a delta, using the FFT. Now, I want to estimate this PSD using the CWT coefficients, using the Global Wavelet Spectrum. But the graphics that remain are not comparable with the original PSD. I need the decomposition to be in the first 16 scales, with the db6 wavelet:
Fs = 1000; % Hz
duracion = 1;
N = Fs * duracion;
t = linspace(-duracion/2, duracion/2, N);
delta = zeros(1, N);
delta(round(N/2)) = sqrt(N);
cantidad_muestras = length(delta);
N = length(delta);
X = fft(delta);
Pxx1_delta = 2*abs(X(1:N/2)).^2/(N*Fs); % PSD
frecuencias = linspace(0, Fs, cantidad_muestras);
frecuencias=frecuencias(1:500);
delta_time=1/Fs;
scales=1:16;
freqs=scal2frq(scales,'db6',delta_time); % computes pseudo frequencies from the scales ..
% Wavelet transform and power spectrum
coefs_base=cwt(delta,scales,'db6'); % computes the Wavelet Transform for dataset at scales
pow_base=(abs(coefs_base)).^2; % computes the Wavelet Time-Frequency Power Spectrum for dataset
% bias correction
bias_corr_pow_base=ones(length(scales),length(t));
for k=1:length(scales)
bias_corr_pow_base(k,:)=pow_base(k,:)/(scales(k));
% after the work of C. Torrence and G. Compo
end
% Time averaged wavelet power spectrum
time_avg_cor_pow_base_spec=mean(bias_corr_pow_base,2);
figure;
plot(freqs,time_avg_cor_pow_base_spec)
title('Bias Corrected Time Averaged Power Spectrum Dataset');
hold on
plot(frecuencias, Pxx1_delta)
return
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Time-Frequency Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
