Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
PRACTICE EXAM 3 PROBLEM 4 SOLUTION 1250 F 14 EX: A file called vidv.m contains the following code that is supposed to compute the voltage across the nth resistor in a voltage divider: y = find_v(Rvec,n) % y = find_v(Rvec,n) % Compute v-divider voltage across nth resistor v_out = vtot*Rvec(n)/Rvec; return An example of how the function would be used for a circuit is as follows: >> vs = 12; >> v_2 = find_v(vs,[10e3, 20e3],2) v_2 = 8.0000 Correct the errors in vdiv.m so it computes voltage dividers correctly. SOL'N: Corrections are shown in red below. function y = vdiv(vtot,Rvec,n) % y = vdiv(Rvec,n) % Compute v-divider voltage across nth resistor y = vtot*Rvec(n)/sum(Rvec); return end