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...

1 answer below »
this is a matlab assignment, I don't need comments just the code


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 disp(‘You clicked button 1.’) case 2 disp(‘You clicked button 2.’) case 3 disp(‘You clicked button 3.’) end Problem 1: The electrical circuit shown consists of resistors and voltage sources. Determine the current in each resistor, using the mesh current 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; -1.7619; 0.5587; 0.2095]) Print the answer on screen in the following format: The current in resister R1 is 0.4952 A. The current in resister R2 is 1.8254 A. The current in resister R3 is 1.7619 A. The current in resister R4 is 0.3492 A. The current in resister R5 is 0.2095 A. 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.
Answered Same DayApr 03, 2021

Answer To: Homework 5: Write one MATLAB program and make use of the MATLAB’s menu function that creates three...

Akriti answered on Apr 17 2021
139 Votes
Problem 2.zip
Problem 2/Ball_Trajectory.m
% Problem 2
%Number of bounces:
N=5;

%Number of points of interest between bounces:
PI=10;
%Velocity reducing factor
VRF=0.8;
%Acceleration of gravity, m/s^2:
g=9.81;
%Initial velocity of the ball, m/s:
V_0=20;
%Initial angle of trajectory, deg:
Alpha=25;
%Initial angle of trajectory, deg:
Theta=30;
V=zeros(N+1,4);
V(1,1)=V_0;
for r=1:N
%Projection of the Initial velocity to X axis, m/s:
V(r,2)=V(r,1)*cosd(Alpha)*sind(Theta);
%Projection of the Initial velocity to Y axis, m/s:
V(r,3)=V(r,1)*sind(Alpha)*sind(Theta);
%Projection of the Initial velocity to Z axis, m/s:
V(r,4)=V(r,1)*cosd(Theta);
%The ball initial velocities after each bounce, m/s:
V(r+1,1)=V(r,4)*VRF;
end
%Time beteween bounces, s:
T_b=2*V(1:N,4)/g;
%Increment of time, s:
IT=T_b/PI;
T=zeros(N,PI+1);
for k=1:N
for m=1:PI+1
T(k,m+1)=T(k,m)+IT(k);
end
end
%X coordinate of the ball due to time, m:
XD=zeros(N,PI+1);
for k=1:N
for m=1:PI+1
XD(k,m)=T(k,m)*V(k,2);
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here