Simulation Simulink Matlab

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

Equation:

Fw(t) = Awave F(w) cos(wt + g)
  • Fw= Wave existing force;
  • Awave= Amplitude of wave= Wave Height/2;
  • t = time= 5 AM, 11 AM, 5 PM, 11 PM;
  • w = corresponding frequency = 2*pi/T;
  • T = Period of wave;
  • g = 0;

where, Awave, Fw and T vary with t.

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

Answers


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.


Need Your Help

Binary search tree insertion - root always null

c binary-search-tree insertion

I have ds code for inserting values in a binary search tree using recursion. The problem is that the root always remains null.

Finding a page created by a php function

php html

I am trying to generate an HTML page using data gathered in a form on another page. I have this tag on the html page with the form: