Function can't see variable
Mostrar comentarios más antiguos
Question 1
Write a function-file can be used to calculate
equivalent resistance of n parallel connected resistor
function Req = equiv_parallel(r)
%r is an input of length n
%req is an output
%usage req= equiv_parallel(r)
%resistances' values
% for example r=[1 2 3 4 5]
r = [1 2 3 4 5]; %resistances' values
n = length(r); %number of resistor
Req = 1/sum(1./r); %sum of all parallel resistor
end
when I'm trying to run this code write as equiv_parallel(r) , matlab gives me "Undefined function or variable 'r'."
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Permanent Magnet en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!