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

Quick Matlab Query

Tags:
  1. Feb 21, 2014 #1
    Take f = 2x^2 + 1. When I run coeffs(f) in Matlab it outputs [2,1]. However I want it to output all the zero coefficients as well, for example [2 0 1] here. How do I do that?
     
    Last edited: Feb 21, 2014
  2. jcsd
  3. Feb 24, 2014 #2

    My first thought would be that you'd need to have f = 2x^2 + 0x + 1 because with what you have f as right now, matlab doesn't know that the x coefficient is 0 if it's not explicitly typed.

    Then again I'm no expert so there's a good chance I'm wrong, just a thought.
     
  4. Feb 24, 2014 #3

    kreil

    User Avatar
    Gold Member

    Does this have to be done symbolically?

    If not you should probably just *start* with f = [2 0 1] and work from there.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Quick Matlab Query
  1. Quick matlab question (Replies: 5)

  2. Matlab quick question (Replies: 1)

Loading...