Thread Subject: solve system of nonlinear equations in simulink

Subject: solve system of nonlinear equations in simulink

From: Masih Mahmoodi

Date: 19 Jan, 2012 05:49:10

Message: 1 of 6

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

Subject: solve system of nonlinear equations in simulink

From: Nasser M. Abbasi

Date: 19 Jan, 2012 05:53:17

Message: 2 of 6

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?

> 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

Subject: solve system of nonlinear equations in simulink

From: Masih Mahmoodi

Date: 19 Jan, 2012 06:27:10

Message: 3 of 6

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" <nma@12000.org> wrote in message <jf8b4d$90k$1@speranza.aioe.org>...
> 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?
>
> > 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
>

Subject: solve system of nonlinear equations in simulink

From: Nasser M. Abbasi

Date: 19 Jan, 2012 06:40:06

Message: 4 of 6

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

Subject: solve system of nonlinear equations in simulink

From: Steven_Lord

Date: 19 Jan, 2012 14:43:52

Message: 5 of 6



"Masih Mahmoodi" <masih.mahmoodi10@gmail.com> wrote in message
news:jf8asm$jli$1@newscl01ah.mathworks.com...
> 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?

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
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: solve system of nonlinear equations in simulink

From: pietro

Date: 20 Jan, 2012 18:00:09

Message: 6 of 6

"Steven_Lord" <slord@mathworks.com> wrote in message <jf9a78$o0s$1@newscl01ah.mathworks.com>...
>
>
> "Masih Mahmoodi" <masih.mahmoodi10@gmail.com> wrote in message
> news:jf8asm$jli$1@newscl01ah.mathworks.com...
> > 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?
>
> 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
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

doesn't matlab function block work in this case?

Pietro

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
solve nonlinear... Masih Mahmoodi 19 Jan, 2012 00:54:13
rssFeed for this Thread

Contact us at files@mathworks.com