user3262494
user3262494

Reputation: 3

Simulation Simulink Matlab

I have a regular wave equation to simulate on MATLAB Simulink :

Equation:

Fw(t) = Awave F(w) cos(wt + g)

where, Awave, Fw and T vary with t.

Can you please give me an idea? Specially using Simulink MATLAB Function!

Upvotes: 0

Views: 185

Answers (1)

am304
am304

Reputation: 13886

Feed Awave, Fw, T and t as inputs to your MATLAB Function, which should look something like this if I understood correctly:

function Fw = wave_fun(Awave,Fw,T,t)
   w = 2*pi/T;
   g = 0; % change if need be
   Fw = Awave * cos(w*t+g);

Note that t is the simulation time in s (you can use a Clock block for that). The other variables need to be defined as a function of time in the base workspace and then you can use From Workspace blocks.

However, this is so simple that a MATLAB Function is unnecessarily complicated in my opinion. Simple mathematical blocks should suffice to combine the inputs and compute the desired output.

Upvotes: 0

Related Questions