Borrar filtros
Borrar filtros

Help with the DC circuit function

3 visualizaciones (últimos 30 días)
Jesus Alejandro Rodriguez Morales
Jesus Alejandro Rodriguez Morales el 2 de Oct. de 2020
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

Respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by