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?
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.
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?
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?
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.
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.
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_).