Question: % (a) solve some trajectories % timeStepperPendulum function % to be updated at bottom of script T = 2; % total time Nt = 1000;

 % (a) solve some trajectories % timeStepperPendulum function % to be

% (a) solve some trajectories

% timeStepperPendulum function

% to be updated at bottom of script

T = 2; % total time

Nt = 1000; % number of timesteps

dt = T/Nt;

% Hamiltonian

Ham = @(x,y) %%% ENTER THE HAMILTONIAN

% test values for the Hamiltonian

Ham_test = Ham([0,pi/6,pi/3],[1,2,3]);

% initial condition

x0 = -pi/3; y0 = 3;

% Forward Euler trajectory

[xFE, yFE] = trajectory(T,Nt,x0,y0,'FE');

% Heun trajectory

[xH, yH] = trajectory(T,Nt,x0,y0,'Heun');

% plot trajectories and superimpose the Hamiltonian

%%% ENTER YOUR PLOTTING INSTRUCTIONS HERE AND ONCE

%%% YOU ARE READY TO SUBMIT THIS PLOT, SET THE

%%% bool1 VARIABLE TO 1

bool1 = 0;

1. (Nonlinear pendulum) Consider the nonlinear pendulum system (') = (_sin a). (a) Implement forward Euler and Heun's method, and draw trajectories emanating from different initial conditions. Superimpose with a contour plot (help contour) of the Hamiltonian function H(x,y) - 3y2 + cos x. (note: the true trajectories satisfy H(x(t), y(t)) = const.] = 1. (Nonlinear pendulum) Consider the nonlinear pendulum system (') = (_sin a). (a) Implement forward Euler and Heun's method, and draw trajectories emanating from different initial conditions. Superimpose with a contour plot (help contour) of the Hamiltonian function H(x,y) - 3y2 + cos x. (note: the true trajectories satisfy H(x(t), y(t)) = const.] =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!