how to solve this problem in matlab better if you use a loop EXAMPLE 6.9 Design
ID: 1996653 • Letter: H
Question
how to solve this problem in matlab better if you use a loop
Explanation / Answer
Matlab Code:
Vt=220;
Eb=0;
Iar=48;
Ra=0.2;
Ias=2*Iar;
n=1;
Eb(n)=0;
Re(n)=((Vt-Eb(n))/Ias)-Ra;
while(Re(n)>0)%enters into loop only when Re is greater than zero
Eb(n+1)=Vt-(Iar*(Re(n)+Ra));
n=n+1;
Re(n)=((Vt-Eb(n))/Ias)-Ra;
end
disp(Re);
disp(Eb);
number_of_stages = n-1;
Rs1 = Re(1)-Re(2);
Rs2 = Re(2)-Re(3);
Rs3 = Re(3)-Re(4);
Rs4 = Re(4);
disp(Rs1);
disp(Rs2);
disp(Rs3);
disp(Rs4);
Command window output:
2.0917 0.9458 0.3729 0.0865 -0.0568
0 110.0000 165.0000 192.5000 206.2500
1.1458
0.5729
0.2865
0.0865
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.