Clear Filters
Clear Filters

Simulating a non linear model in Simulink

2 views (last 30 days)
Ryan Rizzo
Ryan Rizzo on 28 Nov 2018
Edited: Ryan Rizzo on 28 Nov 2018
I am trying to model the non-linear system.
System Equations in Vector format:
Physical Parameters:
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:
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';

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!