3
這段代碼有什麼問題?在MATLAB中求解一個非線性方程組的錯誤
function F = Final_Project_2(x)
F = [(1/x(1)) + (1/x(2))- (2/(7*x(3)));
(x(3)+2*x(4))*(15*x(2))/((x(1)+x(2))*x(3)-0.7/x(3))-14;
(x(3)*((0.576*x(2)/(x(1)+x(2))*x(3)) - 0.27/x(3)))/(x(3)+(0.576*x(2)/(x(1)+x(2))*x(3)) - 0.27/x(3)) -20;
((0.576*x(2)*x(3)/(x(1)+x(2))*x(3)) - 0.27*x(4)/x(3))-100];
這裏是工作區代碼:
x0 = [1; 1; 1; 1]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
[x,fval] = fsolve(@Final_Project_2,x0,options) % Call optimizer
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> Final_Project_2 at 5
F = [(1/x(1)) + (1/x(2))- (2/(7*x(3)));
Error in ==> fsolve at 254
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot
continue.
就是這樣。我想知道爲什麼MATLAB錯誤描述沒有注意到它。我如何解決積極的價值觀? –
它做到了。在剪報中你明確表示:「CAT參數維度不一致」。 –
@PooyaM你是什麼意思「解決積極價值」? –