Clear Filters
Clear Filters

Construct circuit for nodal analysis

16 views (last 30 days)
Ethar
Ethar on 6 Nov 2022
Answered: Florian Rössing on 24 Nov 2022
I am supposed to develop a Matlab script that can read an electric circuit description from a text file, construct the nodal matrix Y and current vector J then calculate the nodal voltage vector V and display it in the command line. The circuit is assumed to consist of resistors and independent DC current sources only. The text file is supposed to be formatted as follows: 10 1 50 2 4 2 4 3 7 1 100 4 10 The first line contains the total number of nodes in the circuit including the reference node. The nodes in the circuit will take the numbers 1, 2, … and the last node is the reference node. Subsequent lines will describe the contents of the circuit. The first number identifies the type of the element, 1 means this is a resistor while 2 is to identify a current source.The second number is the value and The last two numbers are the nodes to which the element is connected. Now I don't what commands to use to explain that to matlab!

Answers (1)

Florian Rössing
Florian Rössing on 24 Nov 2022
Afaik, you should write a parser that reads the lines of your input file and converts the data into the format you need for calculations. But your questions seems very hard to read to me

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!