MATLAB Answers

Program that Analyses a circuit

1 view (last 30 days)
Emma Sellers
Emma Sellers on 22 Oct 2019
So, I have a complicated question...
I am attempting to write a program that analizes a circuit based off of user imput. Right now, I have created an array of symbolic variables to represent my node voltages.. I ask the user to input data on the value of their sources, resistors, etc..
answer = inputdlg({'Please enter a Current Value:','Enter Node Letter:', 'Enter Node Letter:'})
Current = str2double(answer(1,1));
Node1 = str2double(answer(2,1));
= str2double(answer(3,1));
And then assign there answers to the symbolic variables:
if Node1 == 1
Node1 = 0;
Node2 = Current;
if Node2 == 1
Node2 = 0;
Node1 = Current;
if Node1 == 2
Node1 = Nodes(1,2)
Then I want to create a system of equations for nodal analysis..
so I did this
Equation = (Node1-Node2)/Resistor;
and I get the output of something like this..
But i want to get the coefficients of eveythign associated with each node together to create a system of equations... and I have 0 clues..
i did something like this, but it doesn't work
if has(Equation,Nodes(1,1)) == 1
for 1:i
[c,~] = coeffs(Equation)
Matrix1[1,i] = c;
i = i + 1;


Sign in to comment.

Answers (0)

Translated by