Download presentation
Presentation is loading. Please wait.
1
Numerical Solution/Simulation
Euler Method, Applied to a Single 1st Order ODE q1(t)=x(t), m=0 kg, c=1Ns/m, k=5 N/m
4
A particular simulation with x(0)=q1(0)=0, and
F(t)=u(t)=0, t<0, F(t)=u(t)=1 N, t>0
6
Euler Method, Applied to a Set of 1st Order ODE’s
10
q1(t)=x(t), q2(t)= x(t), m=1 kg, c=0.5Ns/m, k=1 N/m q1(0)=0, q2(0)=0
12
q1(0)=0 m, q2(0)= 0 m/s, F(t)=u(t)=0, t<0, F(t)=u(t)=1 N, t>0
14
Code Modules Required to Use ODE45 in Matlab
15
q1(t)=x(t), q2(t)= x(t), m=1 kg, c=0.5Ns/m, k=1 N/m q1(0)=0, q2(0)=0
32
N=5000; tend=100; t=linspace(0,tend,N); % Set up initial conditions for nonlinear model ics=[ ; ]; % ics1=[ ; % ]; %ics=[ics ics1]; for i1=1:6 xo=ics(:,i1) % Simulate Nonlinear Model [t,x]=ode45('InvPendNonlin',t,xo); % Plot simulation of nonlinear model subplot(2,1,1); plot(t,x(:,1),t,x(:,2)); %axis([0 tend ]); xlabel('time (sec)'); ylabel('x1 (rad), x2 (rad/sec)'); title(['x1(0)=',num2str(xo(1)),'x2(0)=',num2str(xo(2))]); grid on; %hold on subplot(2,1,2); plot(x(:,1),x(:,2)); %axis([ ]); xlabel('x1 (rad)'); ylabel('x2(rad/sec)'); hold on; pause; end
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.