vertcat error! in fsolve for 3 variables
이전 댓글 표시
I am trying to optimse a set of 3 quadratic equations with 3 varaibles..
function Wheel_align = myfunct(C)
K1 = 5;
K2 =5;
theta1 = pi/3;
x1=0;
x2=5;
y1=0;
y2=0;
z1=0;
z2=0;
Wheel_align = [(x1 - C(1))^2 + (y1 - 4.33)^2 +(z1- C(2))^2 - (K1)^2;
(x2 - C(1))^2 + (y2 - 4.33)^2 +(z2 - C(2))^2 - (K1)^2;
(x1 - C(1))*(x2 - C(1)) + (y1 - 4.33)*(y2 - 4.33)+ (z1 - C(3))*(z2 - C(3))- abs(K1*K2)*cos(theta1);
C0 = [0;-5;0]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
[C,fval] = fsolve(@myfunct,C0,options) % Call solver
ERROR is as follows:
Error using vertcat
CAT arguments dimensions are not consistent.
Error in myfunct (line 21)
Wheel_align = [(x1 - C(1))^2 + (y1 - 4.33)^2 +(z1- C(2))^2 - (K1)^2;
Error in fsolve (line 243)
fuser = feval(funfcn{3},x,varargin{:});
Error in main_wheel (line 3)
[C,fval] = fsolve(@myfunct,C0,options) % Call solver
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot
continue.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!