How can I write a code for cicuits?

22 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
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)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!