Help with the DC circuit function

조회 수: 10 (최근 30일)
Jesus Alejandro Rodriguez Morales
Hi everyone,
Can someone help me to find the mistake with the circuit equations, please?
The task is the following:
Given a scalar V (Voltage) and a vector R (Resistance coefficients), write a function that finds the voltage values in the points A, B, and C of the circuit. I have attached a picture of the circuit and I wrote the following code.
Thanks in advance!
function Vol = voltage(V,R)
R1 = R(1);
R2 = R(2);
R3 = R(3);
R4 = R(4);
R5 = R(5);
R6 = R(6);
R7 = R(7);
R8 = R(8);
%Writing the linear equations
eq1 = [(1/R5) + (1/R6) + (1/(R8+R4)), -(1/(R8+R4)), 0];
eq2 = [(-1/(R8+R4)),(1/(R3+R4)) + (1/(R8+R4)) + (1/(R7+R4)),(1/(R7+R4))];
eq3 = [0, (-1/(R7+R4)) ,(1/R1) + (1/(R7+R4)) + (1/R2)];
eq4 = [(V/R5); (V/(R3+R4)); (V/R1)];
% Compute the values to solve the matrix with the form (Ax=B)
M = [eq1(1),eq1(2),eq1(3); eq2(1),eq2(2),eq2(3);eq3(1),eq3(2),eq3(3)];
Vol = M\eq4;
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Circuits and Systems에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by