Have a trouble with the function roots

Posted by user3707462 on Stack Overflow See other posts from Stack Overflow or by user3707462
Published on 2014-06-04T14:38:48Z Indexed on 2014/06/04 15:25 UTC
Read the original article Hit count: 140

Hey guys I have multiple problems with using function 'roots'.

I Have to find zeros of 's^1000 + 1'. I made Y = zeros(1,1000) then manually changed the 1000th matrice to '1'. but then 'root' function does not work with it !


Another problem is that I am having trouble with matrix multiplication. The question is finding zeros(roots) of (s^6 + 6*s^5 + 15*s^4 + 20*s^3 + 15*s^2 + 6*s +1)*(s^6 + 6s^5 + 15*s^4 +15*s^2 +6*s +1) so i did:

a = [1 6 15 20 15 6 1]
b = [1 6 15 0 15 6 1]
y = a.*b;
roots(y)

but this gives me

-27.9355 + 0.0000i
  -8.2158 + 0.0000i
   0.1544 + 0.9880i
   0.1544 - 0.9880i
  -0.1217 + 0.0000i
  -0.0358 + 0.0000i

where I calculate the original equation with wolfram then I have made matrix as :

p = [1 12 66 200 375 492 524 492 375 200 66 12 1]
roots(p)

and this gives me :

-3.1629 + 2.5046i   
-3.1629 - 2.5046i
 0.3572 + 0.9340i
 0.3572 - 0.9340i   
-1.0051 + 0.0000i   
-1.0025 + 0.0044i   
-1.0025 - 0.0044i   
-0.9975 + 0.0044i   
-0.9975 - 0.0044i   
-0.9949 + 0.0000i   
-0.1943 + 0.1539i  
 -0.1943 - 0.1539i

and I think the second solution is right (that is what wolfram alpha gave me) How would you answer these two questions through matlab guys?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about matrix-multiplication