Power spectrum of a simple sine wave using simulink
28 ビュー (過去 30 日間)
古いコメントを表示
I am using 2022a version of Simulink.
I am trying to get a power spectrum of a simple sine wave. The signal generator in the picture generates "sin(2*pi*t)", so I put both amplitude and frequency to be 1. It is required to put a sampling rate of 10Hz and simulation time to 10 seconds, so I put 0.1Hz for zero-order hold, and 10 seconds for stop time.
Before I get them run, I put these values for the Spectrum Analyzer:
I think this should be the same as the picture below and generate the power spectrum, but mine keeps display a straight line.
Could you please give an advice for me to get the same power spectrum?
Thanks in advance.
0 件のコメント
回答 (1 件)
Sudarsanan A K
2023 年 10 月 10 日
Hello Doyeon,
I understand that you are trying to visualize the power spectrum of a sine wave using the 'Spectrum Analyzer' block in Simulink. I also note that you have used the 'Signal Generator' block for generating your sine wave and used a 'Zero-Order Hold' block for discretizing the continous signal. Your chosen signal is a pure sinusoid with unit amplitude and frequency, and zero phase. You desire to set a sampling rate of 10 Hz and perform the simulation for 10 seconds. Besides, asper my understanding, you are seeing a flat line on the 'Spectrum Analyzer' instead of the expected impulses at frequencies -1 and 1 as given in the figure attached with the question.
In this case, one possible way to achieve the desired result is by using the 'Sine Wave' block from 'DSP System Toolbox/Sources'. I would allow you to directly set the required format for the time-domain signal. This ensures that the input is correctly interpreted as a time-domain signal with a specific number of samples, allowing the 'Spectrum Analyzer' block to perform spectral analysis and display the frequency content of the input signal accurately.
I have attached below the snapshots showing the model set up and corresponding block properties for your reference:
Note that the 'signal frequency' and 'sample time' is set as per your requirement (1 Hz and 0.1 seconds respectively). The 'Samples per frame' is the number of consecutive samples from each sinusoid to buffer into the output frame, specified as a positive scalar integer.
Further, the block parameter settings for the 'Spectrum Analyzer' is given below.
For a better understanding of the 'Spectrum Analyzer' block in Simulink, you can additionally refer to the following MathWorks Documentation link:
I hope this helps you resolve the issue and gain better understanding of the 'Spectrum Analyzer' block in Simulink.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spectral Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!