Looping problem in this program
Show older comments
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 Comments
Geoff Hayes
on 28 Jun 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
on 28 Jun 2019
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!