For the following circuit shown below: a. Write the mesh equations for the loop
ID: 2966687 • Letter: F
Question
For the following circuit shown below: a. Write the mesh equations for the loop currents of the circuit. b. Write a MATLAB program to solve the mesh equations from part (a). Your program should allow the user to enter interactively the resistors values and the voltage sources. Calculate powers and voltages for R1...R9 c. Implement this circuit using real components for one set of values that you used in part (b); measure the currents and voltages and then compare your measured values with results of part (b) and explain.Explanation / Answer
clc;
clear all;
prompt={'Enter R1:','Enter R2:','Enter R3:','Enter R4:','Enter R5:','Enter R6:','Enter R7:','Enter R8:','Enter R9:','Enter E1:','Enter E2:','Enter E3:','Enter E4:'};
% Create all your text fields with the questions specified by the variable prompt.
title='Circuit Parameter Calculation';
% The main title of your input dialog interface.
answer=inputdlg(prompt,title);
R1 = str2num(answer{1});
R2 = str2num(answer{2});
R3 = str2num(answer{3});
R4 = str2num(answer{4});
R5 = str2num(answer{5});
R6 = str2num(answer{6});
R7 = str2num(answer{7});
R8 = str2num(answer{8});
R9 = str2num(answer{9});
E1 = str2num(answer{10});
E2 = str2num(answer{11});
E3 = str2num(answer{12});
E4 = str2num(answer{13});
% Mess equation
% (R1+R2+R5)*I1 -R2*I2 -R5*I3 = E1-E2
% -R2*I1 +(R3+R4+R6+R2)*I2 +R6*I4 = E2-E3
% -R5I1 + (R5+R8+R7)*I3 + R8*I4 = E4
% R6I2 +R8*I3 +(R8+R9+R6)*I4 = E4
solution = [(R1+R2+R5) -R2 -R5 0; -R2 (R3+R4+R6+R2) 0 R6; -R5 0 (R5+R8+R7) R8; 0 R6 R8 (R8+R9+R6)][E1-E2;E2-E3;E4;E4];
I1 = solution(1); I2= solution(2); I3 = solution(3); I4 = solution(4);
disp('power discipated in R1');
disp(I1^2 *R1);
disp('voltage difference across R1');
disp(abs(I1)*R1);
disp('power discipated in R2');
disp((I1-I2)^2 *R2);
disp('voltage difference across R2');
disp(abs(I1-I2)*R2);
disp('power discipated in R3');
disp(I2^2 *R3);
disp('voltage difference across R3');
disp(abs(I2)*R3);
disp('power discipated in R4');
disp(I2^2 *R4);
disp('voltage difference across R4');
disp(abs(I2)*R4);
disp('power discipated in R5');
disp((I3+I1)^2 *R5);
disp('voltage difference across R5');
disp(abs(I3+I1)*R5);
disp('power discipated in R6');
disp((I2+I4)^2 *R6);
disp('voltage difference across R6');
disp(abs(I2+I4)*R6);
disp('power discipated in R7');
disp(I3^2 *R7);
disp('voltage difference across R7');
disp(abs(I3)*R7);
disp('power discipated in R8');
disp((I3+I4)^2 *R8);
disp('voltage difference across R8');
disp(abs(I3+I4)*R8);
disp('power discipated in R9');
disp(I4^2 *R9);
disp('voltage difference across R9');
disp(abs(I4)*R9);