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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Guillaume
Guillaume il 18 Mag 2019
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 Commento
Michael Gkouvakis
Michael Gkouvakis il 3 Giu 2019
@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?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by