Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab function block in simulink

Status
Not open for further replies.

siliconguru

Electrical
Oct 29, 2003
2
How can I include a matlab user defined function with two inputs and two outputs to a simulink "matlab function block" ?

 
Replies continue below

Recommended for you

I could get two inputs fed to the function block by using the "mux" block. Now I am facing another issue.

In the function, the returned value is a real number. And I set the output width as 1 and set the output type as real. But simulink gives an error "Evaluation of expression resulted in an invalid output. Only finite double outputs are supported".

Does anyone have any idea about this?
 
Can you send a copy of the model for me to look at ?
 
Hi there. There is a block in Simulink called the S-Function block where you define the number of inputs and outputs. In order to use this block, you need first to develop a script using MATLAB Language and save it in an m-file. Then call the m-file into the S-Function block. Try to consider the "help" portion in the MATLAB Web Site.

--------------------------------
Emmanuel A. Gonzalez, E.C.E.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor