Implementing the PSD from its definition

In summary, the conversation is discussing the implementation of plotting the power spectral density for a given deterministic signal using MATLAB. The definition and steps for computing the transform are provided, along with the formula for energy and power. The issue of the PSD being a constant instead of a function of frequency is also mentioned.
  • #1
james1234
19
0
I would be grateful for some direction on this.

I wish to implement the following -
Given a deterministic signal (the feedback signal of a closed-loop stable system) I would like to plot the power spectral density.
The definition I am working with is this:

upload_2015-1-19_20-0-26.png


Implementation (MATLAB):

% Given a signal the plot of the power spectral density over the frequency range 0.1-5 rad/s is given by
% The continuous time Fourier transform

upload_2015-1-19_20-4-34.png


w=.1:.1:5; % 0.1 to 5 rad/s (frequency range of interest)

% Compute the transform
for ii=1:50 % For each frequency increment (50 samples over the interval 0.1:0.1:5)

yy1=um.*sin(w(ii)*t) % where t is a vector of dimension [1, 3610] and um is the time series in question
yy2=um.*cos(w(ii)*t) %

% the intergral
yi1=trapz(t,yy1);
yi2=trapz(t,yy2);

% square of the Fourier transform i.e. |X(omega)|^2
trans(ii)=(yi1^2+yi2^2);

end

figure(1)
plot(w, trans) % |X(omega)|^2

upload_2015-1-19_20-13-33.png
% For a deterministic signal no need to compute the expected value, the power of the signal is instead given by

upload_2015-1-19_20-9-0.png


% Energy: integral of the square of the Fourier transform wrt to frequency
energy = trapz(w, trans);
figure(2)
plot(w,energy) % sadly things have gone awry HERE!

upload_2015-1-19_20-14-39.png
% Power
power = energy / t(end); % where t(end) is the duration of the signal in question
figure(3)
plot(w, power)
The PSD should be a real valued nonnegative function of omega not a constant. Any prompts would be much appreciated!
 

Attachments

  • upload_2015-1-19_20-8-29.png
    upload_2015-1-19_20-8-29.png
    582 bytes · Views: 457
  • #3
The energy of a signal is a single number - a scalar. It is not a function of frequency. After all you integrated over frequency already in order to compute it! Look at numel(energy) and you should see that it is has 1 element.
 

Related to Implementing the PSD from its definition

1. What is the PSD and why is it important in scientific research?

The Power Spectral Density (PSD) is a measure of the power distribution of a signal in the frequency domain. It is important in scientific research because it provides information about the frequency components of a signal and is used in various fields such as signal processing, acoustics, and vibration analysis.

2. How is the PSD calculated from its definition?

The PSD is calculated by taking the squared magnitude of the Fourier transform of a signal and dividing it by the signal's total power. This is commonly expressed in units of power per frequency, such as watts per hertz (W/Hz).

3. What is the difference between a one-sided PSD and a two-sided PSD?

A one-sided PSD only considers the positive frequency values, while a two-sided PSD considers both positive and negative frequency values. This is because for real-valued signals, the negative frequency components are simply the complex conjugate of the positive frequencies and do not provide any additional information.

4. How can the PSD be used to analyze signals?

The PSD can be used to analyze signals by providing information about the frequency components present in a signal. It can be used to identify dominant frequencies, detect periodicity, and compare different signals. It is also useful in filtering and noise reduction techniques.

5. Are there any limitations to using the PSD as a measure of signal power?

Yes, there are limitations to using the PSD as a measure of signal power. The PSD assumes that the signal is stationary, meaning that its statistical properties do not change over time. This may not always be the case in real-world signals, and therefore, the PSD may not accurately represent the signal's power in those cases.

Similar threads

Replies
3
Views
2K
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Advanced Physics Homework Help
Replies
7
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
Replies
1
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
8K
Back
Top