lc =10;
lm=8;
h0=2;
V=2;
N=300;
hp = zeros(N,t0*50);
hn = zeros(N,t0*50);
for t = 0 :.01 :1
for n = 1 : N-1
hp(n,t) = lc/2 - lm/2
hn(n,t) = -lc/2 + lm/2 - (h0*(N-n))+ V*t ;
% rsqp(n,t) = sqrt( h(n,t)^2 + rc^2);
% rsqn(n,t) = sqrt( (h(n,t)-l)^2 + rc^2);
%Acqp(n,t) = int(pi*(( c^2 + rc^2)),c,0,h(n,t)) ;
%Acqp(n,t) = int(pi*(( c^2 + rc^2)),c,0,h(n,t)+lm) ;
end
end
When I run this loop, it shows the error :
Attempted to access hp(1,0); index must be a positive integer or logical.
lm=8;
h0=2;
V=2;
N=300;
hp = zeros(N,t0*50);
hn = zeros(N,t0*50);
for t = 0 :.01 :1
for n = 1 : N-1
hp(n,t) = lc/2 - lm/2
hn(n,t) = -lc/2 + lm/2 - (h0*(N-n))+ V*t ;
% rsqp(n,t) = sqrt( h(n,t)^2 + rc^2);
% rsqn(n,t) = sqrt( (h(n,t)-l)^2 + rc^2);
%Acqp(n,t) = int(pi*(( c^2 + rc^2)),c,0,h(n,t)) ;
%Acqp(n,t) = int(pi*(( c^2 + rc^2)),c,0,h(n,t)+lm) ;
end
end
When I run this loop, it shows the error :
Attempted to access hp(1,0); index must be a positive integer or logical.