Simulating a non linear model in Simulink
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to model the non-linear system.
System Equations in Vector format:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197388/image.jpeg)
Physical Parameters:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197390/image.jpeg)
where x01, x02 and x03 are initial conditions representing displacement, velocity and acceleration.
In order to simulate this non-linear model I used a function block in Simulink:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197391/image.jpeg)
My question is: Should I inlcude the initial conditions to the code below, and if so, how can I achieve this? Since in the code below the initial conditions are unused if initialized as they are.
function [xdot,y] = fcn(x,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
xdot = [x(2); g-((C/m)*(x(3)/x(1))^2); -((R/L) +(((2*C)/L)*(((x(2)*x(3))/((x(1))^2)))))] + [0;0;1/L]*u;
y = x';
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!