14 views (last 30 days)

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

Opportunities for recent engineering grads.

Apply Today
## 24 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822310

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822310

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822385

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822385

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822397

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822397

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822458

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822458

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822460

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822460

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822850

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822850

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822915

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822915

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822924

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822924

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822927

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822927

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822929

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_822929

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823013

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823013

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823041

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823041

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823077

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823077

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823082

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823082

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823186

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823186

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823213

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823213

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823216

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823216

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823249

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_823249

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827913

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827913

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827915

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827915

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827916

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827916

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827920

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827920

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827926

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827926

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827934

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/515696-how-can-i-write-a-code-for-cicuits#comment_827934

Sign in to comment.