COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### how to obtain frequency and power/frequency vectors using Hpsd(...) function

• Email
• Follow

```Hi all,

I have a signal vector (Fase1vuoto1) with length(Fase1vuoto1). I would like to obtain power/frequency values of each frequency component. I used Hpsd=dspdata.psd(...) function and i can obtain the Frequency versus Power/frequency plot. But, i need them in two different vectors. How can i obtain such vectors one for frequency, one for power/frequency.

Fs=5000;

nfft=2^nextpow2(length(Fase1vuoto1));
Pxx=abs(fft(Fase1vuoto1,nfft)).^2/length(Fase1vuoto1)/Fs;

% Create a one-sided spectrum
Hpsd=dspdata.psd(Pxx(1:length(Pxx)/2),'SpectrumType','Onesided','Fs',Fs);

figure(1)
plot(Hpsd)

I need to obtain all frequency values in a vector and Power/frequency values in another vector...
```
 0
Reply Mehmet 4/25/2010 5:56:05 PM

See related articles to this posting

```"Mehmet Demirtas" <karakartal2000@hotmail.com> wrote in message <hr1vnk\$78f\$1@fred.mathworks.com>...
> Hi all,
>
> I have a signal vector (Fase1vuoto1) with length(Fase1vuoto1). I would like to obtain power/frequency values of each frequency component. I used Hpsd=dspdata.psd(...) function and i can obtain the Frequency versus Power/frequency plot. But, i need them in two different vectors. How can i obtain such vectors one for frequency, one for power/frequency.
>
> Fs=5000;
>
> nfft=2^nextpow2(length(Fase1vuoto1));
> Pxx=abs(fft(Fase1vuoto1,nfft)).^2/length(Fase1vuoto1)/Fs;
>
> % Create a one-sided spectrum
> Hpsd=dspdata.psd(Pxx(1:length(Pxx)/2),'SpectrumType','Onesided','Fs',Fs);
>
> figure(1)
> plot(Hpsd)
>
> I need to obtain all frequency values in a vector and Power/frequency values in another vector...

No ideas at all?
```
 0
Reply Mehmet 4/25/2010 7:24:05 PM

1 Replies
522 Views

Similar Articles

12/7/2013 7:23:30 PM
[PageSpeed]