MATLAB: How to calculate the frequency for a Sine Wave when using Sample based signal generation

simulink

In the Sine Wave Block, I only see parameters for Samples per period and Sample Time, but not frequency. How do I calculate the frequency for a Sine Wave when using Sample based signal generation?

Best Answer

If you open the Sine Wave Block's parameters, the top of the window gives you the equation for the samples per period:
Samples per period = 2*pi / (Frequency * Sample time)
Since you specify the Samples per period and the Sample time as parameters, the frequency will be the calculated variable. You can rearrange this equation to find what combination of Samples per period and Sample time will give you the desired frequency.