We were given lab work with either MatLab or Scilab and pretty much no guidance on how these programs work. And i'am stuck on this exercise: Find polynomial y(x) roots, find the interval to which the roots belong and plot the graph. The equation would be: y(x)=x^5-2. I found the roots myself ( at least I think these are roots ):
x =
x
p=x^5-2
p =
5
-2 +x
r=real(r)
r =
-0.9293165
-0.9293165
0.3549673
0.3549673
1.1486984
So how do I plot graph with this and write the interval?
Do you mean real roots ? There is only one real root here. You can obtain these roots and plot the graph of the polynomial (and denote the root location) on [0,2] with the following statements:
x = poly(0, "x")
r = roots(x^5-2)
X = linspace(0,2,100)
plot(X, X.^5-2, X, 0*X, r(5), 0, 'x')
r =
-0.9293165 + 0.675188i
-0.9293165 - 0.675188i
0.3549673 + 1.0924771i
0.3549673 - 1.0924771i
1.1486984