Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with final test MATLAB grader problem: R HW5_2 Given the circuit shown at right. Using Kirchoff's voltage law, the following equations are obtained:

image text in transcribedimage text in transcribedimage text in transcribedNeed help with final test

MATLAB grader problem: R HW5_2 Given the circuit shown at right. Using Kirchoff's voltage law, the following equations are obtained: -V1 + R211 + R414 = 0 -R414 + Rziz + R is = 0 -Rois + Ruiz + 12 = 0 Then, by conservation of charge 11 = 12 + 14 z = iz tis We now have five equations to solve for the five currents Let Vi=100 and V2=50. Write a function M-file that takes as input 5 resistors in an array and returns the 5 currents in an array as output. Your code should be placing the equations in matrix form and using the backslash to solve. For example: >> R=[5 100 200 150 250] * 1000 kOhm >> curr = LoopCurrent (R) ans = 1.0e-03 + 0.9544 0.3195 0.0664 0.6349 0.2531 Function C Reset MATLAB Documentation i function curr = LoopCurrent(R) 2 % five currents in a circuit 3 % curr = LoopCurrent(R) 4 % INPUT: R- array of five resistors 5 % OUTPUT: curr- five currents in the loops in the circuit 6 if numel(R) 5 error ('Too many elements'); 11 end 12 [A] = [1 -1 0 -1 0; 0 1 -1 0 -1; R(1) (R(1) + R(4)) o; [B] = [0; 0; 100; 0; -50; ); 14 curr = A\B; O O R(2) -R(4) (R(2) + R(5)); OOR(3) O-R(5);]; end * Test 4 (Pretest) Failed E=[80 80 80 80 80]. All reistance = 80 Test Code: 1 %one more case, equal resistors 2 R=[80 80 80 80 80]; 3 student=LoopCurrent(R); 4 ref=reference. LoopCurrent(R); assert(isequal(round(student,4), round(ref,4)), 'Failed E=[80 80 80 80 80]. All reistance = 80') 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions

Question

what is a peer Group? Importance?

Answered: 1 week ago