Reconstruct a signal from PSD

18 ビュー (過去 30 日間)
Amelia  Lita
Amelia Lita 2020 年 3 月 11 日
回答済み: Omega 2025 年 2 月 5 日 10:33
MATLAB had a function called 'pyulear' that's used to model a signal's PSD. It made me wonder wheteher or not I can reconstruct a signal based of its PSD. I know that PSD can be created using FFT and I am trying to find the fft of a signal from its PSD. I had tried the code below to see if I had sucessfully reconstruct it, but I can't seem to reconstruct the signal from the PSD using IFFT. Is there any suggestions for me to reconstruct this signal from psd? Thank you.
%PSD to time-domain signal
clc; clear all; close all;
load(fullfile(matlabroot,'examples','signal','ecgSignals.mat'))
%periodogram using fft
t = (1:length(ecgl))';
Fs = 2000;
figure(1)
plot(t, ecgl), grid
title 'ECG Signals with Trends', ylabel 'Voltage (mV)'
N = length(ecgl);
n = 2*N
xdft = fft(ecgl,n);
psdx = (1/(Fs*N)) * abs(xdft).^2;
freq = 0:Fs/length(xdft):Fs*(1-1/length(xdft));
figure(2)
plot(freq,10*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Frequency (Hz)')
ylabel('Power/Frequency (kmdB/Hz)')
%psd to signal using ifft
%magnitude = N*sqrt(psdx(1:2:end));
magnitude = N*sqrt(psdx);
phase = 2*pi*rand(N,1);
FFT = magnitude .* exp(sqrt(-1) .* phase);
signal = ifft(FFT);
signal = abs(signal).^2;
figure(3)
plot(t,ecgl,t,real(signal))

回答 (1 件)

Omega
Omega 2025 年 2 月 5 日 10:33
Hi Amelia,
I understand that you want to reconstruct a signal from its Power Spectral Density (PSD). This can be a little tricky because reconstructing a signal frequires both magnitude and the phase information. However, PSD only provides the magnitude information and not phase.
If available, you can use the phase from the original FFT. For more details you can refer to the following related MATLAB Answer:
Alternatively, you can generate a random phase, but this will not reconstruct the original signal accurately.
Additionally, ensure that the complex spectrum obtained after combining magnitude and phase is symmetric, as the inverse FFT assumes a symmetric spectrum for real-valued signals.
I hope it helps!

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by