Function can't see variable
古いコメントを表示
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'."
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Permanent Magnet についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!