Is there a faster way than repeating this calculation manually?
이전 댓글 표시
I have a function file with 6 equations and 6 unknowns:
function F = TEST6lijn300(x)
F = [(x(1)^2 + x(2)^2 -753233.1);
((1447.5-x(3))^2 + (876.3-x(4))^2-966977.2);
((-72.4-x(5))^2 + (1723.1-x(6))^2-957129.6);
(x(5)^2 - 2*(x(5)*x(1)) + x(1)^2 + x(6)^2 - 2*(x(6)*x(2)) + x(2)^2 - 20449);
(x(3)^2 - 2*(x(3)*x(1)) + x(1)^2 + x(4)^2 - 2*(x(4)*x(2)) + x(2)^2 - 20449);
(x(3)^2 - 2*(x(3)*x(5)) + x(5)^2 + x(4)^2 - 2*(x(4)*x(6)) + x(6)^2 - 20449)];
end
I have managed to solve it using:
x0 = [5; 10; 5; 10; 5; 10]; % Make a starting guess at the solution options=optimset('Display','iter','MaxFunEvals',1000); % Option to display output [x,fval] = fsolve(@TEST6lijn300,x0,options) % Call solver
However I need to do this calculation hundreds of times, only changing the numbers 753233.1, 966977.2, and 957129.6. I have hundreds of sets of these three numbers which need to be pasted into the function file. So far, I have been doing it manually, but there must be a better way..
댓글 수: 1
José-Luis
2013년 1월 16일
What's wrong with passing the values to the function?
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!