Periodogram of a square wave
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I'm doing a DSP project where I need to extract the THD and SNDR of a Sigma-Delta DPWM.
I'm using the MATLAB function "periodogram" on the output to do it, but it returns bad results because the output wave is a square wave and not a sine wave (which amplifies the error). How can I work around that and get the correct periodogram of a square wave?
Thank you very much!
6 个评论
Mathieu NOE
2023-5-31
I don't have accss to this publication
maybe you can take contact with the authors to further discuss that topic
采纳的回答
akshatsood
2023-9-4
编辑:akshatsood
2023-9-6
Hi Gianmarco,
I understand that you working on a Sigma-Delta DPWM. As stated in the question, you have used periodogram on the output square wave, yet it renders bad results. As per my understanding, you can leverage the fft function to compute the Fourier transform of the square wave and then calculate the power spectral density from the Fourier coefficients.
I have assumed a random data to discuss the workaround. Here is the code snippet for you reference
frequency = 10;
duration = 1;
samplingRate = 1000;
% generating square wave
t = 0:(1/samplingRate):(duration-1/samplingRate);
squareWave = square(2*pi*frequency*t);
N = length(squareWave);
Y = fft(squareWave); % computing Fourier transform
% determinging the power spectral density (PSD)
psd = (abs(Y).^2)/N;
f = samplingRate*(0:(N/2))/N; % frequency vector
% plot the square wave and the periodogram
tiledlayout(2,1);
nexttile;
plot(t,squareWave);
ylabel('Amplitude');
title('Square Wave');
grid on;
nexttile;
plot(f, 10*log10(psd(1:N/2+1)));
xlabel('Frequency (Hz)');
ylabel('Power Spectral Density (dB/Hz)');
title('Periodogram of Square Wave');
grid on;

I believe that, following this approach would be helpful in supressing the errors and acheiving a satisfactory result for the periodogram of the square wave.
Have a look at the documentation page for fft function for better understanding
I hope this helps.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!