Error using vertcat Dimensions of matrices being concatenated are not consistent.

3 ビュー (過去 30 日間)
I am using fsolve and to find the steady state values in a system of 35 equations with 35 unkowns and i am receiving the error message "Error using vertcat Dimensions of matrices being concatenated are not consistent" when checking if my code works.
Can you help?
Attached you may the code used.
PS. I am a new user in matlab so excuse my ignorance.

採用された回答

Guillaume
Guillaume 2019 年 5 月 18 日
At least, one of the expressions in your F does not return a scalar. To find which one, you will have to try each one individually. Give some dummy values to x (e.g: x = 1:35) and try each line on its own at the command line,
I've not looked beyound
-exp(w_p)+(1-alpha)*exp(y_e)/(exp(l_pd)*exp(x))
This lines give an error for row vectors x, since you're attempting to divide a scalar by exp(x) which is a row vector. If x is a column vector the division succeed but you'll get a vector in return so you'll certainly see a 'dimension of matrices being concatenated are not consistent' error. Clearly, that x is meant to be something else.
I've not looked past that you may have more typos.
  1 件のコメント
Michael Gkouvakis
Michael Gkouvakis 2019 年 6 月 3 日
@Guillaume I manage to solve the system as you said, however i added some new items and now i get the error:
Solver stopped prematurely.fsolve stopped because it exceeded the function evaluation limit,options.MaxFunEvals = 3500 (the default value).
I am trying to manual change the limit by coding:
options = optimoptions(@fsolve,'Algorithm','levenberg-marquardt','MaxFunEvals',15000) as per manual but with no luck.
Can you help? Morevoer is is "bad sign" for the stability of the system that the itterations are not enough to solve it?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by