Simulink: How to get a cosine wave with 'time dependent frequency'

10 次查看(过去 30 天)
I want to generate a cosine wave with the following equation.
x(t) = cos((wc + wx)t) where wx = w0 * cos(wm * t)
The values of wc,w0,wm are known and can be hardcoded. I am not able to put in the time dependency 't' in wx

回答(2 个)

Meeshawn Marathe
Meeshawn Marathe 2017-8-9
Hi,
To implement this in Simulink, you can try using the "MATLAB Function" Block or the "Interpreted MATLAB Fcn" block. In addition, you would require an input block (In1), found in Simulink Sources.
Define a vector for time "t" (Ex: t=(0:0.01:10)') in the workspace. Go to Configuration Parameters -> Data Import/Export, select input and add [t,t] in the box. (One value of "t" is for simulation time and the other is for the input In1).
If you use a MATLAB function block, you can define the constants within it and write the cosine expression. If you use the other block, you would have to enter the constant values in the command prompt prior to running the model. Connect In1->Fcn block->Scope
Cheers!

Omur Bas
Omur Bas 2017-8-30
To find time explicitly in Simulink, you can use the "Clock" block.

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by