Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

solve system of nonlinear equations in simulink

842 views
Skip to first unread message

Masih Mahmoodi

unread,
Jan 19, 2012, 12:49:10 AM1/19/12
to
Hello everyone,

I am trying to solve a system of nonlinear algebraic equations in simulink. The reason I want to solve equations in simulink (and not MATLAB) is that the input parameters of the objective function are varying with time and a new set of equationa must be solved at each time step.
It appears to me that simulink cannot support fsolve() functions and alike. Can anyone let me know how to construct such a model please?

Thanks very much,
Masih

Nasser M. Abbasi

unread,
Jan 19, 2012, 12:53:17 AM1/19/12
to
On 1/18/2012 11:49 PM, Masih Mahmoodi wrote:
> Hello everyone,
>
> I am trying to solve a system of nonlinear algebraic equations in simulink.
>The reason I want to solve equations in simulink (and not MATLAB) is that the
>input parameters of the objective function are varying with time and a new set
>of equationa must be solved at each time step.

Hello;

So, why can't the above be done in Matlab? can't you generate new set of equations
at each time step in Matlab? Why not?

Masih Mahmoodi

unread,
Jan 19, 2012, 1:27:10 AM1/19/12
to
Yes, I was thinking if I could solve the equations from MATLAB at each time step and send it to simulink and vice versa, but I don't know how to do this. Could you please let me know how I can set up the code structure?

Thanks very much,
Masih

"Nasser M. Abbasi" <n...@12000.org> wrote in message <jf8b4d$90k$1...@speranza.aioe.org>...

Nasser M. Abbasi

unread,
Jan 19, 2012, 1:40:06 AM1/19/12
to
On 1/19/2012 12:27 AM, Masih Mahmoodi wrote:
> Yes, I was thinking if I could solve the equations from MATLAB at each time step and send it
>to simulink and vice versa, but I don't know how to do this. Could you please
>let me know how I can set up the code structure?
>

not my area, but may be this helps:

http://www.mathworks.com/help/toolbox/simulink/slref/toworkspace.html

"To Workspace - Write data to MATLAB workspace"

good luck with your project

--Nasser



Steven_Lord

unread,
Jan 19, 2012, 9:43:52 AM1/19/12
to


"Masih Mahmoodi" <masih.ma...@gmail.com> wrote in message
news:jf8asm$jli$1...@newscl01ah.mathworks.com...
Use the Algebraic Constraint block, perhaps?

http://www.mathworks.com/help/toolbox/simulink/slref/algebraicconstraint.html

I'm not sure if it can solve multiple equations simultaneously (passed in as
a bus?) If it can't, and you are not looking to generate code from the
system, then I think the User-Defined Functions blocks may help you.

http://www.mathworks.com/help/toolbox/simulink/slref/f4-4889.html#f4-5797

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

pietro

unread,
Jan 20, 2012, 1:00:09 PM1/20/12
to
"Steven_Lord" <sl...@mathworks.com> wrote in message <jf9a78$o0s$1...@newscl01ah.mathworks.com>...
doesn't matlab function block work in this case?

Pietro
0 new messages