Program that Analyses a circuit
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
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.. 
like: 
answer = inputdlg({'Please enter a Current Value:','Enter Node Letter:', 'Enter Node Letter:'})
         Current = str2double(answer(1,1));
         Node1 = str2double(answer(2,1));
         Node2
 = str2double(answer(3,1));
 And then assign there answers to the symbolic variables: 
 if Node1 == 1 
                Node1 = 0; 
                Node2 = Current; 
            end
            if Node2 == 1 
                 Node2 = 0; 
                 Node1 = Current; 
            end
            if Node1 == 2
                Node1 = Nodes(1,2)
            end
etc... 
Then I want to create a system of equations for nodal analysis.. 
so I did this 
 Equation = (Node1-Node2)/Resistor; 
     disp(Equation)
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; 
           end 
        end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
				Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
