what is wrong in this code i dont get the correct answer
xleft=0; xright=(9*pi)/4;N=20;x=linspace(xleft,xright,N);x=x';dx=(xright-xleft)/(N-1);yleft=1;yright=1;a=1;b=-2;c=-2;% M is the matrix when multiplied by y gives y'' y' and y
M2=(diag(-2*ones(N,1),0)+diag(ones(N-1,1),-1)+diag(ones(N-1,1),1))/dx^2;M1=(diag(ones(N-1,1),1)-diag(ones(N-1,1),-1))/(2*dx);M0=eye(N);M=a*M2+b*M1+c*M0;%treating boundaries separate
M(1,:)=[1,zeros(1,N-1)];M(end,:)=[zeros(1,N-1),1];k=(sin(x))/((cos(x))+2);k(1) = yleft; k(end) = yright; y=M\k
Best Answer