필터 지우기
필터 지우기

Please help me with the error

조회 수: 1 (최근 30일)
Sam17
Sam17 2017년 12월 15일
답변: Walter Roberson 2017년 12월 15일
clear all;
clc;
N=20; % number of particles.
K=0.5; % Coupling strength.
b=3;
r=0.006;
x0=-1.67;
I=2.8
initial_value= randn(N,1); %initial matrix
F=@(t,x)[x(2)-(x(1).^3)+b.*(x(1).^2)-x(3)+I+K.*(((1/N)*(mean(x(1))))-x(1));1-(5.*(x(1)^2))-x(2);r*[4*(x(1)-x(0))-x(3)]]
[t,x]=ode45(F,[0 100],initial_value);
plot(t,sin(x));
title ('System of equations that represent a coupled neuronal system with different values of N')
grid on;
Error:
I =
2.8000
F =
@(t,x)[x(2)-(x(1).^3)+b.*(x(1).^2)-x(3)+I+K.*(((1/N)*(mean(x(1))))-x(1));1-(5.*(x(1)^2))-x(2);r*[4*(x(1)-x(0))-x(3)]]
Subscript indices must either be real positive integers or logicals.
Error in @(t,x)[x(2)-(x(1).^3)+b.*(x(1).^2)-x(3)+I+K.*(((1/N)*(mean(x(1))))-x(1));1-(5.*(x(1)^2))-x(2);r*[4*(x(1)-x(0))-x(3)]]
Error in odearguments (line 87) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in nov20_project (line 11) [t,x]=ode45(F,[0 100],initial_value);
>>

답변 (1개)

Walter Roberson
Walter Roberson 2017년 12월 15일
You try to use x(0) which would try to index x at the 0'th position. Indices start at 1 in MATLAB.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by