Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

All Courses

All Courses

logo

CHOOSE A CATEGORY

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

Top Job Leading Courses

Automotive

CFD

FEA

Design

MBD

Med Tech

Courses by Software

Design

Solver

Automation

Vehicle Dynamics

CFD Solver

Preprocessor

Courses by Semester

First Year

Second Year

Third Year

Fourth Year

Courses by Domain

Automotive

CFD

Design

FEA

Tool-focused Courses

Design

Solver

Automation

Preprocessor

CFD Solver

Vehicle Dynamics

Machine learning

Machine Learning and AI

POPULAR COURSES

coursePost Graduate Program in Hybrid Electric Vehicle Design and Analysis
coursePost Graduate Program in Computational Fluid Dynamics
coursePost Graduate Program in CAD
coursePost Graduate Program in CAE
coursePost Graduate Program in Manufacturing Design
coursePost Graduate Program in Computational Design and Pre-processing
coursePost Graduate Program in Complete Passenger Car Design & Product Development
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Amit Kumar/
  3. Week 3 - Solving second order ODEs

Week 3 - Solving second order ODEs

Aim:-  ODE is used to describe the transient behavior of a system. A simple example is a pendulum INTRODUCTION The pendulum is a body or mass suspended from a fixed point so that it can swing back and forth under the inflluance of graviy. pendulums are used to regulate the movement of clock because the interaval of…

    • Amit Kumar

      updated on 30 Dec 2020

    Aim:- 

    ODE is used to describe the transient behavior of a system. A simple example is a pendulum

    INTRODUCTION

    The pendulum is a body or mass suspended from a fixed point so that it can swing back and forth under the inflluance of graviy. pendulums are used to regulate the movement of clock because the interaval of time for each complete oscillation, called the period,is constant. The period depends on the length of the pendulum and also to a slight degree, period on the amplitude, the width of the pendulum's swing.

     

     

    OBJECTIVE:-

    This ODE represents the equation of motion of a simple pendulum with damping

     

     

    In the above equation,

    g = gravity in m/s2,

    L = length of the pendulum in m,

    m = mass of the ball in kg,

    b=damping coefficient.

    Write a program in Matlab\Octave that will simulate the pendulum motion, just like the one shown in the start of this challenge.

    use,

    L=1 metre,

    m=1 kg,

    b=0.05.

    g=9.81 m/s2.

    Simulate the motion between 0-20 sec, for angular displacement=0,angular velocity=3 rad/sec at time t=0.

    When you do this you will get the position of the pendulum as a function of time. Use this information to animate the motion of the pendulum, as shown in the below figure.

    writting the code for the function:

     

     EXPLANATION

    . in this function program,the second- order ODE is simplified to the first-order ODE by introducing the them theta1&theta2

    . Then theta1&theta is differentiated and the dtheta_dt gives a column matrix.

      matlab program

     

    clear all 
    close all
    clc
    
    %inputs
    b = 0.05;
    g = 9.81;
    l = 1;
    m = 0.1;
    
    theta_0 = [0;5];
    
    t_span = linspace(0,10,500);
    
    %solve ode
    [t,results] = ode45(@(t,theta) ode_function(t,theta,b,g,l,m),t_span,theta_0);
    
    plot(t,results(:,1))
    hold on
    plot(t,results(:,2))
    xlabel('plot')
    ylabel('time')
    
    ct=1
    for i=1:length(t)
        x0=0;
        y0=0;
        x1=1*sin(results(i,1));
        y1=-l*cos(results(i,1));
        
       % ploting
       plot([x0 x1],[y0 y1],'color','r')
       hold on
       plot([1 -1],[0 0],'color','b')
       
       plot(x1,y1,'.','Markersize',50)
       axis([-1 1 -1 1])
       hold off
       
       
       M(ct) = getframe(gcf);
       ct=ct+1;
       
    end
    movie(M)
    videofile = VideoWriter('pendulum_ODE.avi','uncompressed AVI');
    open(videofile)
    writeVideo(videofile,M)
    close(videofile)
    

     

    EXPLANATION

    . in the above program, the fixed parameters are length, mass, dampaning cofficient,and acceleration due to gravity.

    . Time and angle are given as initial condition.

    . in the t_span command,500 values are taken in between 0to10 times period.

    . using the ode45 command velocity and displacement is plotted in the y-axis against time in the x-axis

    . using the for for loop command the mass at various points and various times are marked in the graph and are plotted.

    . using the movie command the is saved as an uncomprssed avi file.

    PLOT

     

    Leave a comment

    Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

    Please  login to add a comment

    Other comments...

    No comments yet!
    Be the first to add a comment

    Read more Projects by Amit Kumar (52)

    Week - 9 Material Modeling from Raw Data

    Objective:

    AIM:- Material Modeling from Raw Data OBJECTIVE:-  Using the given video link, extract the data from the figure, and used it for validation. Create a material model for the Dogbone specimen using the diagram of the true stress-strain curve (graphite iron). From the above condition simulate…

    calendar

    29 Oct 2023 12:33 PM IST

    • CSS
    • FEA
    Read more

    Week-6 Calculate the Stretch Ratio by comparing the ELFORM (-2,-1,1,2) with Ogden_Material Model.

    Objective:

    AIM:-calculate the Stretch Ratio by comparing the ELFORM OBJECTIVE:- Create a block of 10mmx10mmx10mm dimension with 10 elements for each direction and use the material card attached (Ogden_Material.k) that is representative of the material properties from the above figure. Use appropriate boundary conditions to simulate…

    calendar

    27 Oct 2023 05:47 PM IST

      Read more

      Week - 5 - Modelling Spotwelds

      Objective:

      AIM:-Modelling SpotweldsOBJECTIVE:-In this assignment, you will model spot welds for the given assembly of parts and run a crash test similar to the one in assignment 4. Details about the spotweld location is in the image below. The yellow line signifies the spotweld directions. You need to use 3-7 spot welds along this…

      calendar

      26 Oct 2023 08:40 PM IST

        Read more

        Week - 4 - Crash Box Simulation

        Objective:

        AIM:- Crash Box Simulation OBJECTIVE:-In this assignment, the student needs to simulate a crash test for a crash box for which mesh is given. A crash box is a highly energy-absorbing structure that crashes on application of loads and reduces impact on other components nearby. A full-fledges crashbox is a highly sophisticated…

        calendar

        26 Oct 2023 02:15 PM IST

        • BIM
        • CAE
        • CFD
        • CSS
        • DEM
        • FEA
        • GIS
        • HEV
        • LS-DYNA
        • MBD
        Read more

        Schedule a counselling session

        Please enter your name
        Please enter a valid email
        Please enter a valid number

        Related Courses

        coursecard

        Design loads considered on bridges

        Recently launched

        10 Hours of Content

        coursecard

        Design of Steel Superstructure in Bridges

        Recently launched

        16 Hours of Content

        coursecard

        Design for Manufacturability (DFM)

        Recently launched

        11 Hours of Content

        coursecard

        CATIA for Medical Product Design

        Recently launched

        5 Hours of Content

        coursecardcoursetype

        Accelerated Career Program in Embedded Systems (On-Campus) Courseware Partner: IT-ITes SSC nasscom

        Recently launched

        0 Hours of Content

        Schedule a counselling session

        Please enter your name
        Please enter a valid email
        Please enter a valid number

        logo

        Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.

        https://d27yxarlh48w6q.cloudfront.net/web/v1/images/facebook.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/insta.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/twitter.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/youtube.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/linkedin.svg

        Our Company

        News & EventsBlogCareersGrievance RedressalSkill-Lync ReviewsTermsPrivacy PolicyBecome an Affiliate
        map
        EpowerX Learning Technologies Pvt Ltd.
        4th Floor, BLOCK-B, Velachery - Tambaram Main Rd, Ram Nagar South, Madipakkam, Chennai, Tamil Nadu 600042.
        mail
        info@skill-lync.com
        mail
        ITgrievance@skill-lync.com

        Top Individual Courses

        Computational Combustion Using Python and CanteraIntroduction to Physical Modeling using SimscapeIntroduction to Structural Analysis using ANSYS WorkbenchIntroduction to Structural Analysis using ANSYS Workbench

        Top PG Programs

        Post Graduate Program in Hybrid Electric Vehicle Design and AnalysisPost Graduate Program in Computational Fluid DynamicsPost Graduate Program in CADPost Graduate Program in Electric Vehicle Design & Development

        Skill-Lync Plus

        Executive Program in Electric Vehicle Embedded SoftwareExecutive Program in Electric Vehicle DesignExecutive Program in Cybersecurity

        Trending Blogs

        Heat Transfer Principles in Energy-Efficient Refrigerators and Air Conditioners Advanced Modeling and Result Visualization in Simscape Exploring Simulink and Library Browser in Simscape Advanced Simulink Tools and Libraries in SimscapeExploring Simulink Basics in Simscape

        © 2025 Skill-Lync Inc. All Rights Reserved.

                    Do You Want To Showcase Your Technical Skills?
                    Sign-Up for our projects.