Why is the frequency parameter generated for the Sine waveform of the Signal Generator block generator block different in R2013b?

1 view (last 30 days)
Why is the frequency parameter generated for the Sine waveform of the Signal Generator block generator block different in R2013b?
Building the same model in R2013a and R2013b yields the following code.
R2013a parameter structure example:
P_myModel_T myModel_P = {
1.0, /* Expression: 1
* Referenced by: '<Root>/Signal Generator'
*/
1.0 /* Expression: 1
* Referenced by: '<Root>/Signal Generator'
*/
};
 
R2013b parameter structure example:
P_myModel_T myModel_P = {
1.0, /* Expression: 1
* Referenced by: '<Root>/Signal Generator'
*/
6.2831853071795862 /* Expression: 1
* Referenced by: '<Root>/Signal Generator'
*/
};
 
 

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Sep 2014
In R2013b there was a code generation enhancement made to the Signal Generator block to remove an unnecessary conversion between hertz and rad/sec.  As part of this update the default units for frequency of the sine waveform of the block updated from hertz to rad/sec.
Dragging a new Signal Generator block from R2013a yields:
 
Dragging a new Signal Generator block from R2013b yields:
An example of the computation for R2013a is as follows:
/* SignalGenerator: '<Root>/Signal Generator' */
temp = 6.2831853071795862 * myModel_M->Timing.t[0];
genSignal = sin(myModel_P.SignalGenerator_Frequency * temp) *
myModel_P.SignalGenerator_Amplitude;
 
An example of the computation for R2013b is as follows:
/* SignalGenerator: '<Root>/Signal Generator' */
genSignal = sin(myModel_P.SignalGenerator_Frequency * myModel_M->Timing.t[0]) *
myModel_P.SignalGenerator_Amplitude;
 

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!