This is second time I am posting this quesiton ( if you do not understand it , l
ID: 2085682 • Letter: T
Question
This is second time I am posting this quesiton ( if you do not understand it , leave it alone)
I already tried out some codes from chegg.com but they did not work ! Do Dont Copy from any source.
Please Do both parts (A and B) or leave it alone for someone else
Write a MATLAB function to compute the equivalent resistance Rg of a resistor network in parallel arrangement: 1/Req = 1/R1 + 1/ R2 + .. The MATLAB function should be of the form function [Req] parallel (R) = where the output variable Req is the equivalent resistance and the input variable R is vector containing the values of the resistors R, R2, in the network. Implement your parallel function in two ways: (a) using a for or while loop, and (b) without using any loop. Test your function with the following sets of data: l. R,-5x103, R2 105, R3-10-Explanation / Answer
%matlab code using for loop
function [Req] = parallel(R)
Req_inv = 0;
for i=1:length(R)
Req_inv = Req_inv+(1/R(i));%summing each inverse of resistance value
end
Req = 1/Req_inv;
end
Command window log:
>> Req = parallel([5000 100000 10000])
Req =
3.2258e+003
>>
function [Req] = parallel(R)
Req = 1/sum((1./R));
end
>> Req = parallel([5000 100000 10000])
Req =
3.2258e+003
>>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.