필터 지우기
필터 지우기

How to solve this error?

조회 수: 1 (최근 30일)
Biza Ferreira
Biza Ferreira 2017년 2월 3일
댓글: Torsten 2017년 2월 3일
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
tic;
h=0.1;
format short g
[t,ya]=euler(@funObj,0,1,h,1);
[t,yc]=heun(@funObj,0,1,h,1);
[t,yd]=runge4(@funObj,0,1,h,1);
[t,zf]=ode45(@funObj,tspan,1);
dim = length(t);
yx=yd;
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('------------------------------------------------------------------------------------------------');
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)])
disp('------------------------------------------------------------------------------------------------');
end
  댓글 수: 1
Torsten
Torsten 2017년 2월 3일
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
Torsten.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by