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

조회 수: 33 (최근 30일)
Preetham Narayana Reddy
Preetham Narayana Reddy 2017년 8월 3일
답변: Omur Bas 2017년 8월 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