- #1

- 2

- 0

i have a question for u guys.

i have wrriten this code:

function[a]=search_root_3(x,e)

f1=x^3-10*x^2+15*x+3;

f11=diff(x^3-10*x^2+15*x+3,x,1);

if abs(f1)<=e

fprintf('the root is %d% \n');

return

end

while abs(f1)>=e

x=x-(f1/f11);

f1=x^3-10*x^2+15*x+3;

f11=diff(x^3-10*x^2+15*x+3,x,1);

end

a=x;

end

the goal is to find the root.

when i am trying to run this code i getting the next eror even though i have used f1 (exact form) in other codes seccessfully:

>> [a]=search_root_3(x1,e)

??? Error using ==> mpower

Inputs must be a scalar and a square matrix.

Error in ==> search_root_3 at 10

f1=x^3-10*x^2+15*x+3;

i will be glad to get some help

thanx

arik