In addition to reading and creating MATLAB variables, Simulink can utilize MATLAB functions . Simulink blocks perform a specific operation on inputs and return outputs. This is analogous to a function in text-based code. The MATLAB Function block ( Simulink > User-Defined functions ) allows you to incorporate a MATLAB function directly into your model. Double-clicking on the MATLAB Function block opens a MATLAB Editor: The input, u , and the output, y , of the function are mapped to the input and output, respectively, of the block. Adding additional inputs or outputs will change the number of ports on the block: The MATLAB Function block is useful when incorporating existing MATLAB code and when modeling complicated algorithms. Task 1 In this lesson, you will model the power output from a tidal turbine over the course of several hours. The equation for this is P o w e r = 1 2 C p ρ A ( 2 g | Δ H| ) 3 / 2 . The Sine Wave ...
Komentar