Looping problem in this program
Afficher commentaires plus anciens
Vs=1;
rs=1;
rl=1;
r=10;
ll=2e-3;
VRi(n)=0;
VLi(n)=0;
l=5e-3;
c=10e-6;
g=1;
zo=sqrt(l/c);
t=sqrt(l*c);
zl=(2*ll)/t;
%VOLTAGE AND CURRENT
%n=1
V1=((Vs/rs)+((2*VRi1))/(r+zo))/((1/rs)+(1/(r+zo)));
i1=((V1-(2*VRi1))/(r+zo));
VR1=(2*VRi1)+(i1*zo);
%n=2,....,n-1 (i.e n=2)
&
V2=(((2*VLi2/(zo))+((2*VRi2)/(zo+r)))/((1/zo)+(1/(r+zo)+(g)))); % Every n of VLi n =VRi n is equal to zero (how to define it)
i2=((V2-(2*VRi2)/(r+zo)));
VL2=V2;
VR2=(2*VRi2)+(i2*zo);
&
%n=n(i.e n=11)
V11=(((2*VL11/(zo))+(2*Vi/(rl+zl)))/((1/zo)+(1/(zl+rl)+(g))));
IL=((V11-(2*Vi))/(rl+zl));
V=(2*Vi)+(il*zl);
%REFLECTED VOLTAGES
%n=1
VRr1=VR1-VRi1;
%n=2,....,n-1 (i.e n=2)
&
VLr2=VL2-VLi2;
VRr2=VR2-VRi2;
&
%n=n(i.e n=11)
VLr11=V11-VLi11;
%INCIDENT VOLTAGES
%n=1
VRi1=VLr2;
%n=2,3,....,n-1 (i.e n=2)
&
VLi2=VRr1;
VRi2=VLr3;
&
%n=n(i.e n=11)
VLi11=VRr10;
Vi=-Vr;
The Ampersand symbol (&), from start to end, has to be put into a loop. How do I do it?
2 commentaires
Geoff Hayes
le 28 Juin 2019
Venkatkumar - please clarify what you mean by The Ampersand symbol (&), from start to end, has to be put into a loop. Also, where is n defined? Is that the iterating variable in your for loop? Can you show all of your code?
Venkatkumar M
le 28 Juin 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
