Dimensions of arrays being concatenated are not consistent
Show older comments
Was given an assignment with this code below:
%% Fixed parameters
C=20;
phi=1/15;
VK =-83.3365;
VCa=120;
VL=-60;
gK=8;
gL=2;
gCa=4;
V1=-1.2;
V2=18; % 18
V3=12; % 12
V4=17.4; % 17.4
%% nonlinear functions of V
boltz=@(V,Vh,Vt)(0.5)*(1+tanh((V-Vh)/Vt));
minf=@(V)boltz(V,V1,V2);
dminf=@(V)1/(2*V2)*(sech((V-V1)/V2)).^2;
winf=@(V)boltz(V,V3,V4);
dwinf=@(V)1/(2*V4)*(sech((V-V3)/V4)).^2;
tauw=@(V)1./cosh((V-V3)/(2*V4));
%% Define the right hand side rhs for the model x(1)=V, x(2)=w
I =@(V,w)gK*w*(V-VK)+gCa*minf(V).*(V-VCa)+gL*(V-VL);
rhs=@(x,I0)[1/C*(I0-I(x(1,:),x(2,:)));...
phi*(winf(x(1,:))-x(2,:))/tauw(x(1,:))];
One of the questions was plot all equilibria of rhs(x,I0), where x = [V ; w]', determine the different phase portraits and plot periodic orbits for each portrait.
I begin by redifining rhs with new variables:
M = @(t,x)rhs(x,I0);
t = [0,2*pi];
x0 = [-20;0.4];
M(t,x0);
dM = MyJacobian(M,x0,h);
and I receive:
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
And I do not know why this is so.
Does anybody know?
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!