How can I create a control loop of a nonlinear control system in Matlab/Simulink?

In most cases, the control system is often designed for linear systems,namely,by using the transfer function as a block representing the object to control. However, I have to build a control system to simulate the control of nonlinear object without any linearization. How can I achieve that? Can I use the S-function?

Thanks in advance!

Reply to
workaholic
Loading thread data ...

In Simulink and as appropriate use either blocks from the "Discontinuities" palette or the "Math Block" from the "Math Operations" palette.

Howard

Reply to
hrh1818

Your question is unclear.

Are you doing this work in some tool?

Why are you stopping at simulation?

If you mean "how do I design a controller for a nonlinear system", the answer space is huge, and depends largely on the salient points of the system (there are formal design methods for some simple nonlinear systems, but few real world ones).

If you mean "how do I build the controller in a simulation tool", and if you mean that an "s-function" is a transfer function block, then yes, you can use transfer function blocks for at least part of the work, possibly wrapped with nonlinearities as appropriate to compensate your plant.

Reply to
Tim Wescott

I am sorry,for I am so eagerly to know the answer...

What I really mean is, if I simulate a linear system's control, I only need to build a transfer function and add the feedback to form a classic control loop, as for the nonlinear case, can I simply replace the transfer function block with the s-function block which is define by a m-file like a differential equation to describe the nonlinear system?

say, if I have a system like below:

r =3D=3D=3D=3D> +/- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>= | controller|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>|the object's transfer function|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>y =20 | | =20 | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D| feedback | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Can I change the transfer function into a block

r =3D=3D=3D=3D> +/- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>= | controller|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>|the nonlinear object's differential eqs|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>y =20 | | =20 | | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D| feedback | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The differential equation may be put in a m-file ,and my equation is how can I achieve that, can I use the s-function block to model it? But it seems that the s-function is really complicated, I wish to know if there is any other way?

Thanks for all!

Reply to
workaholic

This is more properly a Matlab question, so it may be helpful to ask it on the Matlab group.

Matlab has a rich set of nonlinear blocks; it may be far easier to build the nonlinear system up from that.

Making s-functions for blocks is documented in the Matlab help. It isn't trivial, but it can be done.

Reply to
Tim Wescott

I know you wanted to work in Matlab, but SimApp offers a very convenient way to represent nonlinear systems with many nonlinearities built in. It is also graphically oriented. Depending on your situation, you can linearize effects like sqrt by providing an x^2 function. For hard nonlinearities like backlash, you will find that the system easily goes into limit cycles. Sometimes you can bias the system to operate in a more friendly region where the analysis can be linearized. Finally, there are more advanced methods available. You can make time responses of nonlinear systems with most nonlinearities, but frequency responses require some form of linearization technique.

But first, try the program for free.

formatting link

Peter

Reply to
Peter Way

Thanks!

Reply to
workaholic

I have no idea what a s function is. If you mean Laplace transforms the answer is no. I use a system of differential equations when I do serious simulation and use RK4 to do the iterations. The differential equations can be linear or non-linear. The PID and feed forwards are part of the forcing function for one of the differential equations. You mention using a block and I assume you are talking about a graphical simulation software package like SimApp, Scicos or Simulink. I have no idea if these programs can do what you want to do graphically but simulations using normal programming is easy enough. The hard part is getting accurate parameters coefficients.

Peter Nachtwey

Reply to
pnachtwey

-- snip --

One of his other responses prodded me to remembering -- an s-function is the Matlab/Simulink native way of building the innards of a block to be simulated. There's a specific format that takes care of initialization, running, and tear-down, so you can write just about anything you want and have it work right inside of a block.

So basically the OP was making the newbie mistake of equating control theory with Matlab/Simulink (heaven knows if he's also making the mistake of equating control _practice_ with control _theory_).

Reply to
Tim Wescott

Let me first ask you a question: have you already launched Simulink and spend one minute looking around? There are tons of blocks for modeling nonolinear phenomena...

-- Z.H.

Reply to
Zdenek Hurak

I have done the job,and my system is really complicated.

Reply to
workaholic

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.