The following circuit consists of five resistances connected to a voltage source
ID: 2082043 • Letter: T
Question
The following circuit consists of five resistances connected to a voltage source V1. There are three loops and four nodes in this circuit. Writing the Kirchhoff's voltage law (KVL) to each loop results the following equations. -V1 - R2i2- R4i4 = 0 -R2i2 + R1i1 + R3i3 = 0 -R4i4-R3i3 + R5i5 = 0 Writing the Kirchhoff's current law (KCL) at each node gives i1 + i2 = i6 i2 + i3 = i4 i3 + i5 = i1 i4 + i5 = i6 a) Write a Matlab code to solve for the currents with inputs provided by the user for the V1 and the five resistances R1, R2, R3, R4, and R5. b) Display the result giving value of each current calculated.Explanation / Answer
clear;
clc;
V1= input('enter the value of voltage: ');
R1=input('enter the value of 1st resistance: ');
R2=input('enter the value of 2nd resistance: ');
R3=input('enter the value of 3rd resistance: ');
R4=input('enter the value of 4th resistance: ');
R5=input('enter the value of 5th resistance: ');
eq1= '-V1-(R2*Ii2)-(R4*Ii4)=0';
eq2= '-(R2*Ii2)+(R1*Ii1)-(R3*Ii3)=0';
eq3= '(R4*Ii4)-(R3*Ii3)+(R5*Ii5)=0';
eq4= 'Ii1+Ii2=Ii6';
eq5= 'Ii2+Ii3=Ii4';
eq6= 'Ii3+Ii5=Ii1';
eq7= 'Ii4+Ii5=Ii6';
syms Ii1 Ii2 Ii3 Ii4 Ii5 Ii6
[Ii1,Ii2,Ii3,Ii4,Ii5,Ii6]= solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,Ii1,Ii2,Ii3,Ii4,Ii5,Ii6)
Ii1=subs(Ii1)
Ii2=subs(Ii2)
Ii3=subs(Ii3)
Ii4=subs(Ii4)
Ii5=subs(Ii5)
Ii6=subs(Ii6)
%there is some wrong in the given equations the basic for the program is like that. for the value of the loop give please use the code given below
clear;
clc;
V1= input('enter the value of voltage: ');
R1=input('enter the value of 1st resistance: ');
R2=input('enter the value of 2nd resistance: ');
R3=input('enter the value of 3rd resistance: ');
R4=input('enter the value of 4th resistance: ');
R5=input('enter the value of 5th resistance: ');
Z = [(R1+R2+R3) -R2 -R3;
-R2 (R2+R4) -R4;
-R3 -R4 (R3+R4+R5)];
V = [0 V1 0]';
% solve for the loop currents
I = inv(Z)*V
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.