Homework 5:
Write one MATLAB program and make use of the MATLAB’s menu function that creates three (3)
interactive menu buttons to solve the following 3 problems. Label the buttons, for example, as
‘Solution 1’, ‘Solution 2’, and ‘Solution 3’. Present one solution when each menu button is clicked.
Menu Example:
choice = menu('Click a button:','Button 1','Button 2’,'Button 3');
switch choice
case 1
XXXXXXXXXXdisp(‘You clicked button 1.’)
case 2
XXXXXXXXXXdisp(‘You clicked button 2.’)
case 3
XXXXXXXXXXdisp(‘You clicked button 3.’)
end
Problem 1:
The electrical circuit shown consists of resistors and voltage sources. Determine the cu
ent in each
esistor, using the mesh cu
ent method based on Kirchhoff’s voltage law.
V1 = 12 V, V2 = 24 V
R1 = 20 Ω, R2 = 12 Ω, R3 = 8 Ω, R4 = 6 Ω, R5 = 10 Ω
(The result for X should be [-1.2667; XXXXXXXXXX; 0.5587; 0.2095])
Print the answer on screen in the following format:
The cu
ent in resister R1 is XXXXXXXXXXA.
The cu
ent in resister R2 is XXXXXXXXXXA.
The cu
ent in resister R3 is XXXXXXXXXXA.
The cu
ent in resister R4 is XXXXXXXXXXA.
The cu
ent in resister R5 is XXXXXXXXXXA.
Problem 2:
(Here is an example answer. Scaling the y axis to 150 is optional.)
Problem 3:
(The answer should look like the following figure.)
Zip the entire hw5 folder.
Rename the hw5.zip to LastName_FirstName_ME105_hw5.zip
Submit the .zip file to Moddle.