• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Nov 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. nodes = input ('Enter number of nodes in the circuit: ')
2. cct = zeros(nodes,5)
3. disp ('The number of nodes entered is:')
4. disp (nodes)
5.
6. for i=1:nodes
7.     Ikey = ['Are there any independant current sources between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
8.     Currentsource = input(Ikey)
9.     if Currentsource == 1
10.         cct(i,1)=input('Input the net current value (in amps) of the combined current source(s) between the nodes: ')
11.     end
12.
13.     Vkey = ['Are there any independant voltage sources between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
14.     voltagesource = input(Vkey)
15.     if voltagesource == 1
16.         cct(i,2) = input('Input the net voltage value (in volts) of the combined voltage source(s) between the nodes: ')
17.     end
18.
19.      Ckey = ['Are there any capacitors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"): ']
20.      cap = input(Ckey)
21.      if cap == 1
22.          C = input('Input the net capacitance value (in farads) of the combined capacitor(s) between the nodes: ')
23.          cct(i,3) = 1/(2*pi*f*C)
24.
25.      end
26.
27.     Lkey = ['Are there any inductors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"):']
28.     ind = input(Lkey)
29.     if ind == 1
30.         L = input('Input the net inductance value (in Henrys) of the combined inductor(s) between the nodes: ')
31.         cct(i,4) = 2*pi*f*L
32.     end
33.
34.     Rkey = ['Are there any resistors between nodes ',num2str(i),' and ',num2str(i+1),' ? (input 1 for "yes" and 0 for "no"): ']
35.     res = input(Rkey)
36.     if res == 1
37.         cct(i,5) = input('Input the net resistance value (in ohms) of the resistor(s) between the nodes: ')
38.     end
39. end
40.
41. f=input('Please enter the range of frequencies: (please use square brackets) \n');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?