**1. Homework Statement**

Our assignement is to fix an .m file, which should produce Newton's method for a function. I'm very new to Matlab and some expressions are weird to me.

**3. The Attempt at a Solution**

So I've got the code to look like this:

Code:

```
function point=teemunewton(xbeg, ybeg, iternmbr)
iternmbr=10;
X=zeros(2,iternmbr);
xbeg=X(1,1);
ybeg=X(1,2);
for roun=2:iternmbr;
x=X(1,roun-1);
y=X(2,roun-1);
X(:,roun)= X(:,roun-1)-inv([8*y 2*x ; 2*x-2*y -2*x+18*y])*[x^2+4*y^2-13, x^2-2*x*y+9*y^2-17];
end
point=X(:,iternmbr)
```

??? Error using ==> mtimes

Inner matrix dimensions must agree.

Error in ==> teemunewton at 11

X(:,roun)= X(:,roun-1)-inv([8*y 2*x ; 2*x-2*y -2*x+18*y])*[x^2+4*y^2-13,

x^2-2*x*y+9*y^2-17];

What does the first error mean? And how should I define the X matrix?

Last edited: