Index Position 1 is invalid. Newton's method program
Ältere Kommentare anzeigen
When I run the following code, I keep getting errors of either Index Position 1 is invalid or out of range subscript depending on my values for x0. Not sure what to do.
x0=[1,1,1,1,1,1,1,1,1]'; %enter estimates
I defined 9 functions (f1-f9)
J=sym(zeros(9));
for j=1:length(vars) %create Jacobian matrix
J(1,j)=diff(f1,vars(j));
J(2,j)=diff(f2,vars(j));
J(....
end
x=[x0];
for i=1:10
x(:,i+1)=x(:,i)-inv(J(x(1,i),x(2,i),x(3,i),x(4,i),x(5,i),x(6,i),x(7,i),x(8,i),x(9,i)))*f(x(1,i),x(2,i),x(3,i),x(4,i),x(5,i),x(6,i),x(7,i),x(8,i),x(9,i))'; %solve for x
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!