Function Format: Be sure to use proper style and format as discussed in previous
ID: 2080957 • Letter: F
Question
Function Format: Be sure to use proper style and format as discussed in previous labs.
Function Inputs: • Vector Rs, whose elements hold the values Rs1 Rs2 Rs3.... Rsn
• Vector Rp, whose elements hold the values Rp1 Rp2 Rp3.....Rpn
Function Outputs: • Scalar Rab, whose value is the computed resistance between terminals A & B
Other Function Requirements: • Check inputs to ensure their sizes are valid… Give user an error if not
o Think carefully about what cases to not allow!
• Check the inputs to be sure that all input resistance values are non-negative
Function Testing: • Perform tests to verify all error and warning checks are working as desired
• Verify by hand the computed solution for a small size problem
• Run the program several times
o Try a variety of number of stages
o Try different values for the resistors
NL Compute Resistance of a "Resistor Ladder" consider the circuit in Figure 5 that is one form ofsomething called a "Resistor Ladder", which is shown with n stages. Your task is to write a MATLAB function that will compute the esistance between terminals A & B. s(i 1) p(n-1 gure 5: Circuit diagram of a resistor ladder having n stages.Explanation / Answer
function Rab=R_Ladder_Fixed(Rs,Rp)
b=Rp(length(Rp))
for n=length(Rs):-1:2
a=Rs(n)+b
b=(a*Rp(n-1)/(a+Rp(n-1)))
end
Rab=b+Rs(n-1)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.