Need code for (c).
Thanks in advance!
Consider the circuit diagram below: The voltage drop across a resistor is V = IR, The sum of all voltage drops in a closed loop sum to zero (Kirchoff's Law). The previous two facts allow us to construct the following system of equations: R6I1 + R1(I1 - I2) + R2(I1 - I3) = V1, R3I2 + R4(I2 - I3) + R1(I2 - I1) = V2, R5I3 + R4(I3 - I2) + R2(I3 - I1) = V3. Let the resistances be given by R1 = 30, R2 = 25, R3 = 20, R4 = 5, R5 = 15, R6 = 10, and let V2 = 10 and V3 = 40. We will be varying V1 throughout this exercise, and solving for the currents, I1, I2, and I3. Write the equations in matrix form Ax = b, and determine the matrices P, L, and U using the lu command so that PA = LU. ANSWERS: Save the matrices PA and LU in A22.dat and A23.dat, respectively. Vary V1 from 50 to 100 in steps of 5 (i.e., V1 = 50, 55, 60, Â , 95, 100) and calculate I1, I2 and I3 as a function of the increasing V1 by solving the system above using LU-decomposition (the two-step procedure is summarized in the next exercise). ANSWERS: Save your results as a matrix of 3 rows and 11 columns in A24.dat (where the first, second, and third rows are the I1, I2: and I3 values, respectively). For the same V1 values from 50 to 100 in steps of 5, create a matrix B that is 3 by 11, one column for every new value of V1 (the second and third rows are the constant V2 and V3 values). Try solving the system AX = B in one fell swoop by using the backslash command: X=A\B;. ANSWERS: Save the resulting X in A25.dat.