1. Not finding help here? Sign up for a free 30min 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!

Matlab code for solving and plotting function x'(t) = 1 + t*sin(t*x)

  1. May 9, 2013 #1
    1. The problem statement, all variables and given/known data

    I am trying to solve and plot the function, x'(t) = 1 + t*sin(t*x) where x(0) = 0 and t_final = 1, in order to compare this exact solution to the approximations of Euler's and Improved Euler's Method. Can anyone help me with the code in order to solve this problem, and then plot it, using Matlab?

    2. Relevant equations

    x'(t) = 1 + t*sin(t*x) where x(0) = 0 and t_final = 1

    3. The attempt at a solution

    I have tried to use dsolve() only to come up with an error.
     
  2. jcsd
  3. May 9, 2013 #2

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    wolfram alpha can't solve it and matlab tells me it can't find a solution either so I'm guessing you can't solve it algebraically. If you use a numerical solver on matlab the solution you get will be so close to the correct solution that if you knew the solution you wouldn't be able to tell the difference, so I'd just use that
     
  4. May 9, 2013 #3
    Thank you for your help! Which numerical solver would you recommend?
     
  5. May 10, 2013 #4

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I don't really understand the differences between them (they are designed to solve much harder problems than this one using varying techniques). I typically use this one
    http://www.mathworks.com/help/matlab/ref/ode15s.html

    but only because it's the one that I have seen used in examples and thus is the one I remember when I have to do something like this. Someone else could better explain what the advantages/disadvantages of each are perhaps, but it doesn't matter to this problem
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab code for solving and plotting function x'(t) = 1 + t*sin(t*x)
  1. Integrate t.sin(t^2-1) (Replies: 15)

Loading...