Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab Difference Equation Loop?

  1. Sep 19, 2012 #1
    Trying to make a three line loop that would differentiate x2√4x+1 to the nth term starting from the original function (n=0) to the 5th derivative (n=5) and then substitute 2 into the derivatives. Here's what I got

    f = @(x) x2√4x+1
    For n=[0:5] - As the nth term goes from 0 to 5
    disp(num2str(subs(diff(f(x),n),2)))
    end

    Matlab says that the nth term must be an actual scalar number instead of a variable. I want the nth term to change so how can I do that?
     
  2. jcsd
  3. Sep 19, 2012 #2

    K29

    User Avatar

    for n = 0:5
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab Difference Equation Loop?
  1. For loop in matlab (Replies: 3)

Loading...