Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simulink: How to generate a sine wave using external source as frequency

1,065 views
Skip to first unread message

satya mishra

unread,
May 5, 2010, 5:40:21 PM5/5/10
to
I am trying to generate a sine wave whose frequency changes dynamically during simulation. The frequency should come as input to the sinewave block from another block.

I would be grateful for any suggestion or help

Guy Rouleau

unread,
May 5, 2010, 6:26:04 PM5/5/10
to
"satya mishra" <dude...@in.com> wrote in message <hrsok4$lg5$1...@fred.mathworks.com>...

> I am trying to generate a sine wave whose frequency changes dynamically during simulation. The frequency should come as input to the sinewave block from another block.
>
> I would be grateful for any suggestion or help

There is no block shipped with Simulink to directly do that. You need to implement the equation y = sin(w*t + phi) using basic blocks like sum, product and trigo.

Guy

satya mishra

unread,
May 5, 2010, 6:36:04 PM5/5/10
to
Well the problem with that kind of implementation is to include simulation time 't'. 'w' can be worked out as 2*pi*dynamic value of 'f'.
thanks
satya

Guy Rouleau

unread,
May 6, 2010, 7:38:04 AM5/6/10
to
"satya mishra" <dude...@in.com> wrote in message <hrsrsk$ldb$1...@fred.mathworks.com>...

> Well the problem with that kind of implementation is to include simulation time 't'. 'w' can be worked out as 2*pi*dynamic value of 'f'.
> thanks
> satya

The Clock block (look in the Sources section of the library browser) can provide you the simulation time.

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/clock.html

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/digitalclock.html

Prashant Sandhi

unread,
Feb 21, 2011, 9:53:04 AM2/21/11
to
Dear Satya Mishra,

Using Simulink

I have a same task as you had about changing input frequency dynamically during simulation is running. I am feeding sine wave input to a plant and every time i get the output the minmax value of the plant I want the input frequency to change (Freq increase/decrease) and in my case I have to change the frequency from 1Hz to 1KHz and the simulation has to continues untill I have the output for all the frequencies.

Kindly let me know if there any way to do this or an example available please send me. I will be very glad to know this.

Thanking you,

With best regards,
Prashant


"satya mishra" wrote in message <hrsrsk$ldb$1...@fred.mathworks.com>...

0 new messages