![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172199/image.png)
How to plot the frequency spectrum in simulink
52 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
!ntel
el 11 de Oct. de 2013
Comentada: !ntel
el 16 de Oct. de 2013
Hello, I am learning matlab and I am trying to plot a frequency spectrum of a simple sine wave in simulink but the problem is i could not get the actual frequency spectrum that I expect... I am using power spectral density to view the frequency spectrum. Will it work fine or am I using a wrong instrument.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150590/image.png)
This is my simulink model to plot the and view the frequency spectrum of a simple sine wave and sine wave characterstics are as:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150592/image.png)
My Matlab version in R2012a. Here when I keep the 'W' as 35 rads/sec but I am getting the frequency spectrum as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150593/image.png)
So here I expect the impulse or peak in the Power Spectral Density graph at 35 but it is showing at 25 Could any one solve this issue for me.
If I am doing wrong by using this instrument to view the Frequency spectrum, please guide me...
Thanks in advance...
0 comentarios
Respuesta aceptada
Jonathan LeSage
el 15 de Oct. de 2013
Editada: Jonathan LeSage
el 15 de Oct. de 2013
By default, the "Power Spectral Density" (PSD) block is set to have a sample time of Ts = 0.1 seconds. You should open the PSD block and lower the sampling time (Ts = 0.05 seconds or less should be sufficient at this frequency). Upon running your Simulink code again, you should see the peak where you originally anticipated it to be!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172199/image.png)
The sinusoidal input that you are providing to the PSD block has a frequency of 35 rad/s or approximately 5.6 Hz. The default sample time of Ts = 0.1 seconds equates to a sampling rate of 10 Hz. To prevent aliasing (where a signal losses information), you should always ensure that sampling rates are double the signal frequencies. This condition is known as the Nyquist rate .
Hope this helps!
Más respuestas (0)
Ver también
Categorías
Más información sobre Parametric Spectral Estimation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!