Electronic – Comparing Responses for Linear and Non-Linear System in Simulink

circuit analysiscurrentMATLABsimulinkvoltage

I am going through and reviewing this unprofessional (I highlight a potential mistake in Section3.4) paper: Nonlinear Model & Controller Design for Magnetic Levitation System

Specifically, I am trying to compare the responses of the linear and non-linear model in Simulink, using the parameters provided in Table 1 of that same paper. I am to comment on any discrepancies.

I am having trouble comparing responses, since they are totally different from each other.I suspect that I may have a mistake/misunderstanding when it comes to plotting the non-linear model. A very brief summary of the paper follows.


System

enter image description here

Non-Linear Vector Format

enter image description here

Linear Model

enter image description here


Comparing Responses – Working

For the non-linear model I used a MATLAB function block, with the following script:

function y = fcn(u)

    % define your constants
    g = 9.81;
    m = 0.05;
    R = 1;
    L = 0.01;
    C = 0.0001; 
    x1 = 0.012;
    x2 = 0;
    x3 = 0.84;


% nonlinear set of equations
x = [x2; g-((C/m)*(x3/x1)^2); -((R/L)*x3 + (((2*C)/L)*(((x2*x3)/((x1)^2)))))] + [0;0;1/L]*u;

y = x';

I then gave a step input to the system and got the following result. Yellow is the step input, green is the output.

enter image description here


Next, I proceeded with the linear model. I placed the matrices A, B, C and D inside a state space block.

enter image description here

To get the numbers you see above, I replaced the constants with the parameters given in the paper. I got the following output.

![enter image description here


As can be seen, both responses are completely different, and I am unsure about what discrepancies I should comment about. Are my non-linear and linear model implementations correct? I can add further details or workings if required.

Simulink build

enter image description here

Parameters:

enter image description here

Any help would be appreciated.

Best Answer

Ah HA!. You used a Matlab nonlinear function block, but you're misunderstanding the system equation. The function \$\dot{\vec x} = f(\vec x, u)\$ is coughing up the derivative of \$\vec x\$, not \$\vec x\$ itself. You need to have a function block that just finds \$\dot{\vec x}\$ from \$\vec x\$ and \$u\$, then feeds it to an integrator (Simulink should be able to integrate a vector just fine) and feeds the \$\vec x\$ back to the block, and extracts \$y\$ from it.

Here's a block diagram of what you want to achieve (sorry for the crappy picture). I can't remember my Simulink well enough to say exactly how to do it -- I suspect you can make a multi-input, multi-output block, but if you can't you can make a concatinated input vector with x and u, and concatenate y and x-dot in the output, and use muxing and demuxing to get the data in and out.

enter image description here

Related Topic