How to solve this error?

1 view (last 30 days)
Biza Ferreira
Biza Ferreira on 3 Feb 2017
Commented: Torsten on 3 Feb 2017
Hello Friends, I have a small problem, I am solving a first order equation problem, and i use euler, heund, range-kutta, and ode45 methods, so when I try display a table in the matlab command Window devolve me the following error:
Error using horzcat Dimensions of matrices being concatenated are not consistent.
if true
% code
clear all
format short g
dim = length(t);
disp('------METODO EULER, EULER MOD., HEUN , RUNGE-KUTTA, ODE23 , ODE45 , ODE113 , SOL. EXATA------');
disp('t(i) ye(i) yem(i) yh(i) yk(i) y23(i) y45(i) y113(i) sol. exacta');
disp([t(1:dim), ya(1:dim) , yb(1:dim) , yc(1:dim) , yd(1:dim) , y23(1:dim) , y45(1:dim) , y113(1:dim) , yx(1:dim)])
  1 Comment
Torsten on 3 Feb 2017
Check where the error happens.
If it happens in the line
disp([t(1:dim), ya(1:dim) , yb(1:dim) , yc(1:dim) , yd(1:dim) , y23(1:dim) ,...
check whether the length of t is the same after each call to the respective integrator.
Best wishes

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!