Borrar filtros
Borrar filtros

"To RESHAPE the number of elements must not change" error during plot

2 visualizaciones (últimos 30 días)
Hayao
Hayao el 24 de Jun. de 2017
Comentada: Hayao el 25 de Jun. de 2017
Dear all,
I have a function (1x1 symfun) S4(t) with a variable of t. It's a very very long expression so I cannot write them here but it is a multi-exponential function.
Then I did:
t = 0:0.0000001:0.00002
y = S4(t)
plot(t,y)
However, I got "To RESHAPE the number of elements must not change". I have no idea where this came from because I have never used the command RESHAPE. Also, the first time around, when S4(t) was a slightly more compact function and rest of the script exactly the same, I did not have this issue.
I think the command "y = S4(t)" is the problem, but I don't see why it's not good. What am I doing wrong?
Thank you
  15 comentarios
Jan
Jan el 25 de Jun. de 2017
Ah, the partially contained message might mean, that this is a problem of sym/disp, so only the display in the command window is affected? Then try to supress this output using a semicolon.
Hayao
Hayao el 25 de Jun. de 2017
As far as I know, with the command "y = S4(t)" after t being defined "0:0000001:0.00002", y should out put all S4(t) corresponding to the defined t. The output window did not even attempt this and instead returned an error. The diary also does not show this and returns an error before the output.
So I believe that it's not the output suppression problem. I think, as others have said, could be overflow or something. I've sent the entire script to Walter Roberson. So I guess I'll wait for what he can tell me.

Iniciar sesión para comentar.

Respuesta aceptada

dpb
dpb el 24 de Jun. de 2017
"S4(t)" is symbolic and a (very) long character expression whereas "t" is double vector. plot is trying to turn them both into column vectors but they're not of commensurate lengths so it aborts.
You can try to convert the symbolic expression to numeric first but if it is so long it may not succeed; you may need to reformulate your problem to use numeric solution rather than explicit symbolic. Doing so would probably also reduce your calculation time by orders of magnitude.
  2 comentarios
Hayao
Hayao el 24 de Jun. de 2017
Editada: Hayao el 24 de Jun. de 2017
I am a little bit reluctant in using numeric solution. I am using system of 135 linear differential equation to solve this under matrix eigenvalue problem formulation. Since I am changing the "concentration of luminescent center" to compare the result, the comparison should be of small difference, so I am afraid that I lose the precision required for the comparison when I used numeric solution.
Also, I don't know how to obtain numeric solution to such large system of differential equation.
Do you think vpa would work?
dpb
dpb el 24 de Jun. de 2017
"Do you think vpa would work?"
No, not really, I don't. What have you got to lose to try, however, you've reached/exceeded the limits of practicality and crashed symbolics this way.
I suspect you're going to have to reformulate the solution technique rather than being able to brute-force a direct solution.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by