Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nodes = input ('Enter number of nodes in the circuit: ')
- cct = zeros(nodes,5)
- disp ('The number of nodes entered is:')
- disp (nodes)
- for i=1:nodes
- Ikey = ['Are there any independant current sources between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
- Currentsource = input(Ikey)
- if Currentsource == 1
- cct(i,1)=input('Input the net current value (in amps) of the combined current source(s) between the nodes: ')
- end
- Vkey = ['Are there any independant voltage sources between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
- voltagesource = input(Vkey)
- if voltagesource == 1
- cct(i,2) = input('Input the net voltage value (in volts) of the combined voltage source(s) between the nodes: ')
- end
- Ckey = ['Are there any capacitors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"): ']
- cap = input(Ckey)
- if cap == 1
- C = input('Input the net capacitance value (in farads) of the combined capacitor(s) between the nodes: ')
- cct(i,3) = 1/(2*pi*f*C)
- end
- Lkey = ['Are there any inductors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
- ind = input(Lkey)
- if ind == 1
- L = input('Input the net inductance value (in Henrys) of the combined inductor(s) between the nodes: ')
- cct(i,4) = 2*pi*f*L
- end
- Rkey = ['Are there any resistors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"): ']
- res = input(Rkey)
- if res == 1
- cct(i,5) = input('Input the net resistance value (in ohms) of the resistor(s) between the nodes: ')
- end
- end
- f=input('Please enter the range of frequencies: (please use square brackets) \n');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement