Python Encyclopedia for Academics
  • Course Outline
  • Artificial Intelligence
    • Data Science Foundation
      • Python Programming
        • Introduction and Basics
          • Variables
          • Print Function
          • Input From User
          • Data Types
          • Type Conversion
        • Operators
          • Arithmetic Operators
          • Relational Operators
          • Bitwise Operators
          • Logical Operators
          • Assignment Operators
          • Compound Operators
          • Membership Operators
          • Identity Operators
      • Numpy
        • Vectors, Matrix
        • Operations on Matrix
        • Mean, Variance, and Standard Deviation
        • Reshaping Arrays
        • Transpose and Determinant of Matrix
      • Pandas
        • Series and DataFrames
        • Slicing, Rows, and Columns
        • Operations on DataFrames
        • Different wayes to creat DataFrame
        • Read, Write Operations with CSV files
      • Matplotlib
        • Graph Basics
        • Format Strings in Plots
        • Label Parameters, Legend
        • Bar Chart, Pie Chart, Histogram, and Scatter Plot
  • Machine Learning Algorithms
    • Regression Analysis In ML
      • Regression Analysis in Machine Learning
      • Proof of Linear Regression Formulas
      • Simple Linear Regression Implementation
      • Multiple Linear Regression
      • Advertising Dataset Example
      • Bike Sharing Dataset
      • Wine Quality Dataset
      • Auto MPG Dataset
    • Classification Algorithms in ML
      • Proof of Logistic Regression
      • Simplified Mathematical Proof of SVM
      • Iris Dataset
  • Machine Learning Laboratory
    • Lab 1: Titanic Dataset
      • Predicting Survival on the Titanic with Machine Learning
    • Lab 2: Dow Jones Index Dataset
      • Dow Jones Index Predictions Using Machine Learning
    • Lab 3: Diabetes Dataset
      • Numpy
      • Pandas
      • Matplotlib
      • Simple Linear Regression
      • Simple Non-linear Regression
      • Performance Matrix
      • Preprocessing
      • Naive Bayes Classification
      • K-Nearest Neighbors (KNN) Classification
      • Decision Tree & Random Forest
      • SVM Classifier
      • Logistic Regression
      • Artificial Neural Network
      • K means Clustering
    • Lab 4: MAGIC Gamma Telescope Dataset
      • Classification in ML-MAGIC Gamma Telescope Dataset
    • Lab 5: Seoul Bike Sharing Demand Dataset
      • Regression in ML-Seoul Bike Sharing Demand Dataset
    • Lab 6: Medical Cost Personal Datasets
      • Predict Insurance Costs with Linear Regression in Python
    • Lab 6: Predict The S&P 500 Index With Machine Learning And Python
      • Predict The S&P 500 Index With Machine Learning And Python
  • Artificial Neural Networks
    • Biological Inspiration vs. Artificial Neurons
    • Review linear algebra and calculus essentials for ANNs
    • Activation Function
  • Mathematics
    • Pre-Calculus
      • Factorials
      • Roots of Polynomials
      • Complex Numbers
      • Polar Coordinates
      • Graph of a Function
    • Calculus 1
      • Limit of a Function
      • Derivative of Function
      • Critical Points
      • Indefinite Integrals
  • Calculus 2
    • 3D Coordinates and Vectors
    • Vectors and Vector Operations
    • Lines and Planes in Space (3D)
    • Partial Derivatives
    • Optimization Problems (Maxima/Minima) in Multivariable Functions
    • Gradient Vectors
  • Engineering Mathematics
    • Laplace Transform
  • Electrical & electronics Eng
    • Resistor
      • Series Resistors
      • Parallel Resistors
    • Nodal Analysis
      • Example 1
      • Example 2
    • Transient State
      • RC Circuit Equations in the s-Domain
      • RL Circuit Equations in the s-Domain
      • LC Circuit Equations in the s-Domain
      • Series RLC Circuit with DC Source
  • Computer Networking
    • Fundamental
      • IPv4 Addressing
      • Network Diagnostics
  • Cybersecurity
    • Classical Ciphers
      • Caesar Cipher
      • Affine Cipher
      • Atbash Cipher
      • VigenΓ¨re Cipher
      • Gronsfeld Cipher
      • Alberti Cipher
      • Hill Cipher
Powered by GitBook
On this page
  • 1. Steps for Nodal Analysis:
  • 2. Solve the System of Equations:
  • 3. Circuit Breakdown
  • 4. KCL Equations
  • 4. Simplified Equations:
  • 5. Matrix Form
  • 6. Python code
  • Keywords
  1. Electrical & electronics Eng
  2. Nodal Analysis

Example 1

Nerd Cafe

PreviousNodal AnalysisNextExample 2

Last updated 2 months ago

To solve the circuit in Fig. below using Nodal Analysis, we will calculate the voltage at each node step by step. Let’s start by identifying the steps and equations involved.

1. Steps for Nodal Analysis:

Assign Node Voltages:

  • Label the node voltages as 𝑉1, 𝑉2, 𝑉3, 𝑉4 and 𝑉0 (ground node).

  • 𝑉0 is already set to 0 V as the reference.

  • 𝑉1 is equal to 8 V.

  • 𝑉4 is equal to (-8) V.

Apply Kirchhoff's Current Law (KCL):

  • At each node, the sum of currents leaving the node equals zero.

Write Equations for Each Node:

  • Using Ohm’s Law (𝐼=𝑉/𝑅).

2. Solve the System of Equations:

  • Use substitution or matrix methods to find the node voltages.

3. Circuit Breakdown

Known Values:

  • Voltage sources: 𝑉1=8V, 𝑉2=8V.

  • Resistances: 𝑅1=4Ξ©, 𝑅2=6Ξ©, 𝑅3=7Ξ©, 𝑅4=9Ξ©, 𝑅5=10Ξ©.

  • Current sources: 𝐼1=5A, 𝐼2=6A.

4. KCL Equations

Node 1 (𝑉1):

V1=8V_{1}=8V1​=8

Node 2 (𝑉2):

V2βˆ’84βˆ’5+V26+V2βˆ’V37=0\frac{V_{2}-8}{4}-5+\frac{V_{2}}{6}+\frac{V_{2}-V_{3}}{7}=04V2β€‹βˆ’8β€‹βˆ’5+6V2​​+7V2β€‹βˆ’V3​​=0

Node 3 (𝑉3):

V3βˆ’V27+V3βˆ’(βˆ’8)9+V310+6=0\frac{V_{3}-V_{2}}{7}+\frac{V_{3}-(-8)}{9}+\frac{V_{3}}{10}+6=07V3β€‹βˆ’V2​​+9V3β€‹βˆ’(βˆ’8)​+10V3​​+6=0

Node 4 (V4):

V4=βˆ’8V_{4}=-8V4​=βˆ’8

4. Simplified Equations:

Node 2 (Simplified):

V2(14+1++17)+V3(βˆ’17)=7β‡’V2(0.5595238)+V3(βˆ’0.142857)=7V_{2}\left( \frac{1}{4}+\frac{1}{+}+\frac{1}{7} \right)+V_{3}\left( -\frac{1}{7} \right)=7\Rightarrow V_{2}\left( 0.5595238 \right)+V_{3}\left( -0.142857 \right)=7V2​(41​++1​+71​)+V3​(βˆ’71​)=7β‡’V2​(0.5595238)+V3​(βˆ’0.142857)=7

5. Matrix Form

The equations can be expressed in matrix form as:

[0.5595238βˆ’0.142857βˆ’0.1428570.353968][V2V3]=[7βˆ’6.8888]\begin{bmatrix} 0.5595238 & -0.142857 \\ -0.142857 & 0.353968 \end{bmatrix}\begin{bmatrix} V_{2} \\ V_{3} \end{bmatrix}=\begin{bmatrix} 7 \\ -6.8888 \end{bmatrix}[0.5595238βˆ’0.142857β€‹βˆ’0.1428570.353968​][V2​V3​​]=[7βˆ’6.8888​]

6. Python code

Here’s the Python code to solve the node voltages using NumPy for matrix operations:

import numpy as np

# Coefficient matrix
A = np.array([
    [0.5595238, -0.142857],
    [-0.142857, 0.353968]
])

# Constant matrix
B = np.array([7, -6.8888])

# Solve the linear system Ax = B
solution = np.linalg.solve(A, B)

# Print the results
V2, V3 = solution
print(f"V2 = {V2}")
print(f"V3 = {V3}")

Output

V2 = 8.408113665230585
V3 = -16.06823810662589

Keywords

nodal analysis, kirchhoff's current law, KCL, circuit analysis, node voltage method, electrical engineering, electronic circuits, DC circuits, AC circuits, linear circuits, circuit solving techniques, voltage nodes, current sources, resistive circuits, mesh analysis, supernode, circuit theory, circuit equations, Ohm's law, engineering education