Azzera filtri
Azzera filtri

How to get a sin function in simulink

19 visualizzazioni (ultimi 30 giorni)
Oskar
Oskar il 15 Dic 2017
Risposto: Star Strider il 15 Dic 2017
I need a sin function in Simulink to calculate something like 5sin((x/20000)t). I have tried to create a function with 5*sin((u(1)/20000)*t) but I get a syntax error.
edit: I actually need to add two signals 5sin((x/20000)t) and 10cos((x/30000)t)

Risposte (2)

Jim Riggs
Jim Riggs il 15 Dic 2017
Modificato: Jim Riggs il 15 Dic 2017
I'm a little confused by the problem statement. Inside the sine function you have x/2000 * t. I'm not sure which represents the independent variable (i.e. is it a function on x or t? Is it a function on t where x is a constant?) I will assume that the function is based on time, t and x is a coefficient.
In Simulink you have a couple of choices. First is the "sin trigonometric function" block. This block simply performs the sin function on the input signal. Assuming the input signal is time, you will have to construct an input signal with a gain (multiplier) of x/2000, then multiply the output by 5 to get {5 sin (x/2000 t)}
Another option is to use the "sine wave function" block. This block has settings for "amplitude", "bias", "Frequency", and "Phase".
Set Phase to zero for a sine function, and to pi/2 for a cosine function.

Star Strider
Star Strider il 15 Dic 2017
Try this:

Community Treasure Hunt

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

Start Hunting!

Translated by