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

Roots in Matlab

  1. Sep 17, 2011 #1
    Dear Fellow,

    I need to find the roots of equation
    x^8- 2x^6+3x^4-7x^2+a=0
    in MATLAB, in such a way that I need 4 non repeating roots.

    I have used the technique of
    p=[1 -2 3 -7 1]
    s=roots(p)
    x1=s(1)
    x2=s(2)
    x3=s(3)
    x4=s(4)
    where xi,i=1,2,3,4 are roots of the above equation,

    2nd option my friend gave me is

    p=[1 -2 3 -7 1]
    s=sqrt(roots(p))
    x1=s(1)
    x2=s(2)
    x3=s(3)
    x4=s(4)
    this will again give me four roots of the equation,

    need your help to find the four roots of above equation.


    Regards
     
  2. jcsd
  3. Sep 17, 2011 #2

    uart

    User Avatar
    Science Advisor

    Clearly your polynomial is in x^2, so your friends solution is the correct one. Though you should of course use the plus and minus (+/-) of the roots.
     
  4. Sep 17, 2011 #3
    Okay ,,,, thanks uart,, thats really help full
     
  5. Sep 18, 2011 #4
    can you please give my any idea how to define vertical axis in matlab plot command

    thanks
     
  6. Sep 18, 2011 #5

    Pythagorean

    User Avatar
    Gold Member

    it's automatically designated by your data set, but you can also set particular properties of the axis with (for example):

    set(gca,'YTick',[0 0.05 0.075 0.1 0.15 0.2 0.25])

    and you could even go as far as to label each of the points:

    set(gca,'YTickLabel','0|0.05|Cutoff|0.1|0.15|0.2|0.25')

    full documentation:
    http://www.mathworks.com/help/techdoc/creating_plots/f1-19798.html [Broken]
     
    Last edited by a moderator: May 5, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Roots in Matlab
Loading...