How can i avoid this error: 'Index exceeds array bounds.' in my code?

조회 수: 1 (최근 30일)
Francesco Lasco
Francesco Lasco 2018년 5월 30일
댓글: Francesco Lasco 2018년 5월 30일
clear all;
close all;
clc;
%Rabinovich–Fabrikant equations
t0 = 0;
tf = 100;
y0 = [1 1 1]';
[t,y]=ode23(@rf,t0:0.01:tf,y0);
comet3(y(:,1),y(:,2),y(:,3));
function dydt= rf(y,~)
%parametri
alf=1.1;
gamm=0.87;
dydt = [y(2)*(y(3)-1+y(1)^2)+gamm*y(1);...
y(1)*(3*y(3)+1-y(1)^2)+gamm*y(2);...
-2*y(3)*(alf+y(1)*y(2))];
end
I keep getting the former error even if i don't use an index greater than 3, and i defined the y0 vector with three elements in it. Thanks for your help!

채택된 답변

Torsten
Torsten 2018년 5월 30일
function dydt= rf(~,y)
Best wishes
Torsten.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by