Question
This is a matlab question. Below you can see there is code. This is the circuit.m file the problem wants you to use. The actual
This is a matlab question. Below you can see there is code. This is the circuit.m file the problem wants you to use. The actual question is in bold. Please include code as well as the answer to what V2 should be. Thank you so much!
This is the code from the function file circuit.m:
function is = circuit(V2)
% Coefficients in the system of equations
R1 = 10;
R2 = 20;
R3 = 40;
V1 = 35;
% The coefficient matrix
A = [1 1 -1; R1 0 R3; 0 R2 R3];
% RHS vector
B = [0; V1; V2];
% solving the system
is = A\B;
end
This code can be imputted and used to answer the next part of the question.
We already have a function file called circuit.m that solves for the currents in the following system of equations:
i1 + i2 = i3
V1 i1R1 i3R3 = 0
V2 i2R2 i3R3 = 0
The circuit has R1 = 10, R2 = 20, and R3 = 40. The first battery has a fixed voltage V1 = 35V , but the second battery can be adjusted to anything between 20V and 60V . We want the current i3 to be 0.8A. We will find the V2 that produces this current by starting at V2 = 20V and incrementing V2 by 0.01V until we get i3 greater than or equal to 0.8A. Write a .m file called current.m that calls circuit.m inside a while loop in order to determine what voltage we should select for V2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started