i got an error as Error in memristor2 (line 29) q(i)=Qo*Ro​(1-sqrt(1-​(2*n*(Roff​-Ron)*flux​(i)))/(Qo*​Ro*Ro))/(n​*(Roff-Ron​));

1 view (last 30 days)
i got an error as Error in vet(line 29) Subscript indices must either be real positive integers or logicals
q(i)=Qo*Ro(1-sqrt(1-(2*n*(Roff-Ron)*flux(i)))/(Qo*Ro*Ro))/(n*(Roff-Ron));
This is my code Which is given below,
mr=10^-10;
Ron=100;
Roff=16000;
D=10^-9;
f=1;
T=1/f;
n=1;
w=.01*D;
Qo=(D^2)/(mr*Ron);
Ro=Ron*(w/D)+Roff*(1-w/D);
dt=0.001;
i=1;
for t=0:dt:1
I(i)=10e-3*(sin(2*pi*f*t));
flux(i)=(1-cos(w*t)/(w));
M(i)=Ro*sqrt(1-(2*n*(Roff-Ron)*flux(i))/(Qo*Ro*Ro));
q(i)=Qo*Ro(1-sqrt(1-(2*n*(Roff-Ron)*flux(i)))/(Qo*Ro*Ro))/(n*(Roff-Ron));
w(i+1)=w(i)-mr*Ron*q(i)./D;
v(i)=M(i)*I(i);
i=i+1;
end
Can anyone help me to overcome this error.Thanks in advance.

Answers (0)

Categories

Find more on MATLAB 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!