Be the first to rate this file! 4 Downloads (last 30 days) File Size: 11.31 KB File ID: #16363
image thumbnail

Discrete Time Integrator in Embedded MATLAB

by Kiran Kintali

 

13 Sep 2007 (Updated 14 Aug 2008)

This demo shows how to use Embedded MATLAB block parameters to control the algorithm behavior

| Watch this File

File Information
Description

The attached Simulink model implements a Forward Euler Integrator in Embedded MATLAB. It illustrates the use of parameters in Embedded MATLAB.

The algorithm has three sections; Setup, Output and Update.

At every sample time hit the block keeps accumulating the the value of the input at time instant 't' in a state register and emits value accumulated value until time instant 't-1'. The output value is clipped if falls above an upper limit or falls below a lower limit. A flag is raised when the value is clipped. The upper and lower limits and the gain of the integrator can be changed via Embedded MATLAB block parameters.

Like any other block in Simulink the Embedded MATLAB block also supports mask parameters. Simulink parameters can be tunable or non-tunable. Tunable parameter values can be changed during the simulation run in MATLAB workspace and can be used to affect the current Simulink simulation run in progress. Non-tunable parameters are also defined in MATLAB workspace but are fixed for a single simulation run.

In the attached model the variables 'gain_val', 'upper_limit', 'lower_limit' used in the Embedded MATLAB script are non-tunable parameters. They are declared as any other inputs in the
function declaration associated with the block. However they do not appear as block inputs. The values and types of these variables can be defined and changed in the MATLAB between simulation runs.

Required Products Fixed-Point Toolbox
Simulink
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
14 Aug 2008

add to eML category

Tag Activity for this File
Tag Applied By Date/Time
embedded matlab Kiran Kintali 22 Oct 2008 09:27:02
embedded matlab Kiran Kintali 22 Oct 2008 09:27:02
discrete Kiran Kintali 22 Oct 2008 09:27:02
integrator Kiran Kintali 22 Oct 2008 09:27:02
hdl Kiran Kintali 22 Oct 2008 09:27:02
fpga Kiran Kintali 22 Oct 2008 09:27:02
simulink Kiran Kintali 22 Oct 2008 09:27:02
parameters Kiran Kintali 22 Oct 2008 09:27:02

Contact us at files@mathworks.com