The code below , when I execute it, ub,u, p, q arrays are shown like 101 times since ii=101 in the code. What I mean is the loop does not work. Could you look at it please

`ii=101;`

dt=0.0001;

t = 0:dt:1000;

dx=0.01; %step size

pi=4.*atan(1);

fik=0.4;

H1=0.5;

H1D=0;

A=0;

AD=0.1;

ADinit=AD;

c1b=0.5;

c2b=1-c1b;

dc=0.001;

for i=1:ii;

x=(i-1)*dx;

fikness=fik*sin(pi*x);

ub1(i)=(c1b-H1D*(x-0.5)+AD/2*(x-0.5)^2)/(H1-0.5*fikness-A*(x-0.5))

ub2(i)=(c2b+H1D*(x-0.5)-AD/2*(x-0.5)^2)/(1-H1+0.5*fikness+A*(x-0.5))

end

c1=c1b+dc;

c2=1-c1;

for i=1:ii;

x=(i-1)*dx;

fikness=fik*sin(pi*x);

u1(i)=(c1-H1D*(x-0.5)+AD/2*(x-0.5)^2)./(H1-0.5*fikness-A*(x-0.5))

u2(i)=(c2+H1D*(x-0.5)-AD/2*(x-0.5)^2)./(1-H1+0.5*fikness+A*(x-0.5))

end

p1(1)=0.5*(1-u1(1)^2);

q1(1)=0;

p2(1)=0.5*(1-u2(1)^2);

q2(1)=0;

for i=2:ii

q1(i)=q1(i-1)-dx*(u1(i-1)-ub1(i-1))/dt

p1(i)=0.5*(1-u1(i)^2)+q1(i)

end

for i=2:ii;

q2(i)=q2(i-1)-dx*(u2(i-1)-ub2(i-1))/dt

p2(i)=0.5*(1-u2(i)^2)+q2(i)

end

ub1,ub2,u1,u2,p1,p2,q1,q2 =1*101, all of them have one row 101 column How can I access the whole arrays of ub1,ub2,u1,u2,p1,p2,q1,q2 ??

http://stackoverflow.com/questions/21054170/overwritten-values-in-loops-matlab