Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Solution/Simulation

Similar presentations


Presentation on theme: "Numerical Solution/Simulation"— Presentation transcript:

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

2

3

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

5

6 Euler Method, Applied to a Set of 1st Order ODE’s

7

8

9

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

11

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

13

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

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

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

33


Download ppt "Numerical Solution/Simulation"

Similar presentations


Ads by Google