Question

For the DC circuit shown here, Kirchhoff’s Rules and Ohm’s Law tell us the following relationships...

For the DC circuit shown here, Kirchhoff’s Rules and Ohm’s Law tell us
the following relationships between the currents I1, I2, I3, I4, the resistances R1, R2, R3,
and the voltage V provided by the battery:
I2+ I3=I1
I2+ I3=I4
I1R1+ I3R3=V
I1R1+ I2R2=V
Write a function find_current.m which takes as inputs the values for V , R1, R2, and R3,
and returns as output a column vector containing the values of the currents I1, I2, I3, I4,
in that order.
Suppose R1= 100 Ohms, R2= 200 Ohms, and V = 9 Volts. Plot I2, I3,
and I2+I3versus R3using the values R3= 0.1, 0.2, 0.3, · · · , 10000 Ohms, in two different
ways.
First, in figure(1), plot this using linear axes; this is what you get from the plot
command. All three quantities I2, I3, and I2+ I3should be shown in this one figure.
Second, in figure(2), plot this with a linear vertical axis and a logarithmic horizontal
axis; this is what you get from the semilogx command, which uses the same syntax as
the plot command. Again, all three quantities I2, I3, and I2+ I3should be shown in this
one figure.
Your figures must have labelled axes (including units), and use the legend command to
specify which curve is which.
Please submit the files find_current.m and plot_current.m.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program Screen Shot:

Sample Output:

Program Code to Copy:

%

%

function I = find_current(V,R1,R2,R3)
% express the equations in form Ax = b

%% A
A = [
-1 1 1 0;
0 1 1 -1;
R1 0 R3 0;
R1 R2 0 0
];
%
%% b
b = [
0;
0;
V;
V
];
%
%% solving for I
I = A\b;

end
__________________________________________


%% plot_current.m
%
clc,clear,close all
%% input data
%
R1 = 100; R2 = 200; % Ohms
V = 9; % Volts
%
R3 = 0.1:0.1:10000; % 0.1,0.2,0.3,...,10000 Ohms
%
%% computing the current vector I, using the find_current function
%
for i=1:length(R3)
I = find_current(V,R1,R2,R3(i)); % compute current on for each value of R3
% extract current values from the the column vector I
I1(i) = I(1);
I2(i) = I(2);
I3(i) = I(3);
I4(i) = I(4);
end
%
%% plotting
%
figure,plot(R3,I2,'- b',R3,I3,'- g',R3,I2+I3,'- r')
legend('I_2','I_3','I_2+I_3'),grid on,grid minor
xlabel('R_3 [Ohms]'),ylabel('Current [Amperes]')
%
%% plot with logarithm
%
figure,semilogx(R3,I2,'- b',R3,I3,'- g',R3,I2+I3,'- r')
legend('I_2','I_3','I_2+I_3'),grid on,grid minor
xlabel('R_3 [Ohms]'),ylabel('Current [Amperes]')

------------------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP
~yc~

Add a comment
Know the answer?
Add Answer to:
For the DC circuit shown here, Kirchhoff’s Rules and Ohm’s Law tell us the following relationships...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT