hi this is my code

can anyone fix it for me, to include the error... i got it right without it, but for some reason putting the error in, stuffs it up, and cant find where

it says something about the matrix must be square????

Code:

```
function [y]=BJ(n,x)
N=100;
b=pi;
a=0;
h=(b-a)/N;
% Remeber that y(1) is the first element, not y(0).
S=0;
for i=0:N-1
tj=i*h;
delta=a:b;
y(1)=cos((n*tj)-x*sin(tj));
y(2)=cos((n*(tj+h/3))-x*sin(tj+h/3));
y(3)=cos((n*(tj+(2*h/3)))-x*sin(tj+(2*h/3)));
y(4)=cos((n*(tj+h))-x*sin(tj+h));
y4(delta)=((x^4)*((cos(delta))^4)-4*n*(x^3)*((cos(delta))^3)+(4+6*(n^2))*(x^2)*((cos(delta))^2)-4*x*n*(1+(n^2))*cos(delta)+(n^4)-3*(x^2)*((sin(delta))^2))*cos(n*delta-x*sin(delta))+6*sin(n*delta- x*sin(delta))*((n^2)-2*x*cos(delta)*n+(x^2)*((cos(delta))^2)+(1/6))*x*sin(delta);
S = S+((h/8)*y(1))+((3*h/8)*y(2))+((3*h/8)*y(3))+((h/8)*y(4))-((3*(h^5)/80)*(y4(delta)));
end
y=1/pi*S;
end
```

it says something about the matrix must be square????

Last edited by a moderator: