Challenge

Week 3 - Solving second order ODEs

Explanation

1. First we need to appy system parameters b,g,l,m and then initial condition of theta_0 and time

2. using function apply the formula for second order ode

function [dtheta_dt] = ode_func(t,theta,b,g,l,m)

theta1 = theta(1)
theta2 = theta(2)
dtheta1_dt=theta2;
dtheta2_dt=-(b/m)*theta2 - (g/l)*sin(theta1);
dtheta_dt = [dtheta1_dt ; dtheta2_dt];
end

3. and then we need to plot the displacement and velocity

4. and the loop for animation set x1=0 y1=0 and theta1 = t_span

5. and then calculate x2 y2 value using trignometric functons of sin and cos

6. after getting the values plot figure 2 of line and animation plot with markersize and color

7. we fix orgin of pendulam x and y lines with color

8. and we fix the limits for graph with label and title

9. set the time inetrval

10. after appy movie command for videconvertion afterthat filedestination and file name

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.