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);
>>

Réponses (1)

Walter Roberson
Walter Roberson le 15 Déc 2017

0 votes

You try to use x(0) which would try to index x at the 0'th position. Indices start at 1 in MATLAB.

Catégories

En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by