|
From: | Ahmed Husain ?Abbas Mohamed Sahrab |
Subject: | Questions about signal analysis |
Date: | Mon, 31 Oct 2016 20:54:20 +0000 |
Hello
I've got a question about finding the PSD (Power Spectral Density) in octave, I looked at the documentation and used the following code to find it. [y, fs] = audioread("song1.wav");
NFFT=32768; %Sample Size
F=fft(y,NFFT);
F_Shift=fftshift(F); %Shifting the FFT
fVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;
%To adjust the X axis to suit the plot
hold on
L=length(y); %Finds the length of the y variable which is a vector
Px=F_Shift.*conj(F_Shift)/(NFFT*L);
figure
plot(fVals,Px,'r');
title('Power Spectral Density');
xlabel('Frequency in Hertz')
ylabel('Power');
Best Wishes
Ahmed Suhrab |
[Prev in Thread] | Current Thread | [Next in Thread] |