1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab: Numerically Integrate and Plot Response of Underdamped System

  1. Mar 16, 2014 #1
    1. The problem statement, all variables and given/known data
    Numerically integrate and plot the response of an underdamped system determined by m= 100 kg,
    k= 20,000 N/m, and c = 200 kg/s, subject to the initial conditions of x0 = 0.01 m and v0 = 0.1 m/s, and the applied force F(t)=150cos(5t). Then plot the exact response.

    2. Relevant equations

    3. The attempt at a solution

    I've been trying to use matlab to solve this question, but I'm having a little trouble. I started by defining the variables and the time durations. I was attempting to use the state space form to solve the problem, hence I defined matrices A, B, C and D

    Code (Text):

    m=100; k=20000; c=200; x0=0.01; v0=0.1; f0=150; w=5;

    A=[0 1; -k/m -c/m];
    B=[0; 1];

    C=[0 1;1 0];






    When I run the code I get:

    Error using DynamicSystem/lsim (line 98)
    Invalid syntax for time or frequency response command. See command help for more

    Error in ME_3504_chapter2_80a (line 17)

    I don't understand what the problem is. I can see it's to do with lsim, but I'm not sure how to fix it. I suspect that it may have something to do with the initial conditions x0 and v0.

    Any advice would be greatly appreciated. Thank you
    Last edited: Mar 16, 2014
  2. jcsd
  3. Mar 16, 2014 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    If you have written Matlab routines to solve your problem, please share them so that we can make sense of the errors you have gotten. Don't forget to use
    Code (Text):
     tags for the source.
  4. Mar 16, 2014 #3
    I've added the
    Code (Text):
     tags but I'm not sure what you mean by Matlab routines.
  5. Mar 16, 2014 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted