Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Oct 29, 2003
Messages
2
Location
US
How can I include a matlab user defined function with two inputs and two outputs to a simulink "matlab function block" ?

 
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

Back
Top