Error using horzcat dimensions are not consistent

1 visualización (últimos 30 días)
Muhammad Ali
Muhammad Ali el 22 de En. de 2020
Comentada: Guillaume el 22 de En. de 2020
Hi the file is attached. Kindly check this and guid me for removing the error.

Respuesta aceptada

Guillaume
Guillaume el 22 de En. de 2020
Why are x and t symbolic? This just slows down everything for no gain. I'm not even sure that your code would work (but I don't have the symbolic toolbox so can't check).
Why can't you find the problem yourself? Break down the expression that give you the error until you locate the problem. This is exactly what we'd have to do.
Saying that, the problem looks obvious to me:
A=[a.*F b.*G c.*H 0; ...
a*F, b*G and c*H are 41x41 matrices. You then try to stick a 1x1 zero next to it. As the error tells you, that's not possible, everything you concatenate horizontally must have the same number of rows.
A = [a*F, b*G, c*H, zeros(size(x, 1), 1); ...
may work. It stick a 41x1 column vector of 0s to the end. Or you may have meant zeros(size(x)) which sticks a 41x41 matrix of 0s to the end.
You will of course have to do the same for the rest of the expressions, with zeros and ones.
  8 comentarios
Muhammad Ali
Muhammad Ali el 22 de En. de 2020
U is basically three soliton solution.
Guillaume
Guillaume el 22 de En. de 2020
"why matlab is giving determinant 0, while in actual calculation they are nonzero. is there any mistake in writing the matrices."
There might be an error in the way you wrote the matrix. I wouldn't know since I've no idea what they represent and anyway I don't have the time to analyse your matrices. You can check the determinant yourself with det(A), etc.
"U is basically three soliton solution."
Sorry, I don't understand this sentence. In any case, as I said, currently your U is the sum of two ratios of determinants, so it will always be scalar even if the determinants are not 0. It sounds like there's definitively a mistake in your U expression.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by