Use matlab to solve the problem Specifications for your func
Use matlab to solve the problem. Specifications for your function are as follows:
The input argument to your function is the number of loops in the circuit.
The output argument for your function is a vector containing the loop currents.
To determine the loop currents, your function will need to perform the following steps:
Use a nested for loop to create the A matrix by asking the user for the resistance value sums needed for each location
 HINT: the sprintf function may be useful in creating the message asking the user what value to enter
Use a loop to create the b vector by asking the user for the sum of the voltage sources in each loop
Solve the matrix equation to obtain the loop currents
Solution
MATLAB code:
clear all
 close all
 clc
 x=input(\'Enter number of loops :\');
 i=0;
 j=0;
 for i=1 : x
     for j=1:x
         A(i,j)=input(\'enter Resistor values :\');
     end
 end
 for k=1 : x
            B(k,:)=input(\'enter voltage values :\');
 end
 A
 B
 I=inv(A)*B
sample output
Enter number of loops :2
 enter Resistor values :1
 enter Resistor values :2
 enter Resistor values :3
 enter Resistor values :4
 enter voltage values :5
 enter voltage values :6
A =
     1     2
      3     4
 B =
     5
      6
 I =
   -4.0000
     4.5000
>>


