linearize a second-order system without symbolic math toolbox or linearize command or tf command in matlab

To linearize a second-order nonlinear system in Matlab without using the Symbolic Math Toolbox or the linearization functions (linearize, tf), you need to use system identification. System identification aims to estimate a mathematical model for a system based on input-output measurements. We can use the estimated model to make predictions or design a controller for the nonlinear system.

Here's a general approach to linearize a second-order nonlinear system without the Symbolic Math Toolbox or linearization functions:

  1. Collect input-output data for the non-linear system. Inputs are the signals applied to the system, and outputs are the system's responses.
  2. Plot the input-output data to visualize the system's behavior. It's essential to plot the data to see whether the system is linear or nonlinear. A nonlinear system's output typically exhibits saturation, oscillatory behavior, or hysteresis.
  3. Choose the input-output data that you believe is most representative of system behavior. Make sure that the chosen data covers the input range you want the system to operate in.
  4. Estimate a mathematical model from the input-output data using system identification. You can use various system identification techniques, such as linear regression, ARX (Auto Regressive with eXogenous inputs), and ARMAX (Auto-Regresive with eXogenous inputs and Moving Average). I'll use ARX as an example in this case.

Here's an example code snippet using ARX to linearize a second-order nonlinear system:

main.m
% Generate input signal for the nonlinear system
t = linspace(0,10,1000);
u = 3*cos(t) + 1.5*sin(3*t);

% Simulate the second-order nonlinear system
nonlin_sys = @(t,x,u) [x(2) ; -x(1)^3 + u];
[t,x] = ode45(@(t,x) nonlin_sys(t,x,interp1(t,u,t)), t, [0,0]);

% Collect input-output data from the nonlinear system simulation
y = x(:,1); % Output signal
data = iddata(y,u',t(2)-t(1)); % Create an iddata object

% Estimate a second-order ARX model for the nonlinear system
sys_2nd_order = arx(data,[2 2 1]); % ARX order structure: [na nb nk]

% Linearize the second-order nonlinear system model around operating point
sys_lin = linearize(sys_2nd_order,mean(data.u),mean(data.y));

% Plot the Bode plot of the linearized system
bode(sys_lin)
738 chars
21 lines

In this example code, we generate an input signal (u) for the nonlinear system and simulate its behavior using the ODE solver ode45. We collect input-output data from the simulation and use the arx function to estimate a second-order ARX model (sys_2nd_order) for the nonlinear system. Then, we use the linearization function linearize to obtain a linear model (sys_lin) of the system around its operating point. Finally, we plot the Bode plot of the linearized system to visualize its frequency response.

Note that this is just a general approach, and you may need to modify it to suit your specific problem. Also, the accuracy of the estimated model depends on the quality of the input-output data and the appropriateness of the system identification technique.

gistlibby LogSnag