Hi all,
I'm new to Matlab, this is my first matlab question and i used lots oftime to solve it but there are some unknown problem that i cant solve.
Question:
Write a MATLAB program, in a m-file that determines the solution ofthe equation 8-4.5(x-sin x)=0 by using bisection method. The solutionshould have approximation eorr of less than 0.001%. Create a table thatdisplay the value of X
1 , X
u , f(x)f(y) and
a for each iteration of the bisection process.
My current answer after a week of solving:
a = 2
b = 3
for x=a:b
y(a)=8-4.5*(x-sin(x))
y(b)=8-4.5*(x-sin(x))
c = (a + b)/2
for x=c
y(c)=8-4.5*(x-sin(x))
end
if y(c)==0
answer = y(c), break,
elseif y(a)*y(c)<0
a=c
end
end
----------------------------------------------
I got this error message,

Attempted to access y(2.5); index must be a positive integer or logical.
Error in ==> Untitled at 8
y(c)=8-4.5*(x-sin(x))
------------------------------------
Your help and guidance is appreciated. Thanks