I have this problem that i would like to solve preferably in MATLAB
Solve:
$$\frac{d^2y}{dx^2} + \sin(y) = 0$$
with endpoint conditions $y(0) = 0$ and $y(0.5) = 0.2618$.
I think i have to plot the solution. I would appreciate any kind of help.
My incomplete solutions until now is:
a=0;b=10; %limits
h=0.00001; %step
N=round((b-a)/h)+1; %nodes
x=zeros(N,1);% init solution vectro
x(1)=0; %initial condition
% y(1) = 0.2618; - i still need the second condition
for i=2:N
x(i)=x(i-1)+h*y(i-1);
y(i)=y(i-1)- h * sin(x(i-1));
end
plot(a:h:b, x);
hold on;
