MATLAB Answers

How can I write a code for cicuits?

14 views (last 30 days)
Mariam Al Zarouni
Mariam Al Zarouni on 6 Apr 2020
Commented: layla Hweij on 14 Apr 2020
I am asked to Write a program in MATLAB to analyze a circuit. The circuit contains of n Resistors, n/2 capacitors, n/2 coils and an AC voltage source in the form of V Vm wt = + cos( )  .
The following requirements should be fulfilled
1. The number of resistances, n, has to be even number.
2. The minimum value for n is 2.
3. If the number of resistances is n, the number of coils must be n/2 and the number of capacitors must be n/2. The user will be prompted to enter the correct number if it is different from n/2
4. The values of all resistors, coils and capacitors must be real and positive
Please help me with the code.. I'm dying trying to find videos and tutorials
Sample example 1 (note: The red colour represents the data entered by the user) Enter the resistance values in ohm, [R1...Rn]=[10 30 20] The number of resistances should be even. Reenter values of the two resistances in Ohm, [R1...Rn]=[10 20 40 100] ==============================================================================
Enter the capacitance values in Farads, [C1...Cn/2]=[0.01 0.02 0.04]
The number of capacitors should be 2, 1/2 number of resistances Enter the capacitance values in Farads, [C1...Cn/2]=[0.01 0.02] ==============================================================================
Enter the inductance values in Henry, [L1...Ln/2]=[0.3 0.2] ==============================================================================
Enter the amplitude of the voltage source in volt, Vmag=10
Enter the phase of the voltage source in degree, Vphase=0
Enter the frequency of the voltage source in rad/s, Freq=100

  24 Comments

layla Hweij
layla Hweij on 14 Apr 2020
this is rest of mariam question if you want a clearer verison of what im saying
==============================================================================
The Alpha should be positive real number between (0 and 2), check the value and enter it again
Enter the Alpha (between 0 and 2) to be used with the Successive Relaxation Method=0.5
==============================================================================
The impedance matrix to solve the mesh current is:
1.0e+02 *
0.1000 - 0.0100i -0.1000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
-0.1000 + 0.0000i 0.3000 - 0.0003i -0.2000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i -0.2000 + 0.0000i 0.6000 - 0.0050i -0.4000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i -0.4000 + 0.0000i 1.4000 - 0.0005i
The voltage vector to solve the mesh current is:
10
0
0
0
I'm stuck at this point
||
v
approximated, exact=
1.7813+0.33424i 1.7857+0.33861i
0.816+0.15698i 0.81954+0.16005i
0.33475+0.067759i 0.33674+0.069396i
0.095532+0.019329i 0.096204+0.019862i
relative error, significant digit=
0.0034088 3
0.0056082 2
0.0074962 2
0.0087305 2
Magnitude Phase
1.8124 10.6275
0.8310 10.8894
0.3415 11.4432
0.0975 11.4380
Please if you can help us, it will be wonderful since I dont have much time left to the deadline ...
darova
darova on 14 Apr 2020
Create new question
and use special button
layla Hweij
layla Hweij on 14 Apr 2020
and here is the result including the voltage vector , the actual current and supposed relaxation method that will give me the approximated current
========================================
The Voltage vector to solve the mesh current is:
10
0
0
0
The current:
1.166 - 0.16397i
0.14959 - 0.28057i
0.062247 - 0.11448i
0.01285 - 0.034543i
========= this is Relaxation Method ========
0
0
0
0
0

Sign in to comment.

Answers (0)