In this part, you are going to create a MATLAB Graphical User Interface (GUI) using GUIDE.
The GUI you need to create uses the function written in 'Part 3 - Plotting Projectile Motion' (see below). It allows a user to input various values for inputs x0, y0, V0x and V0y, and then the user can press a 'redraw plot' button to update the figure of projectile motion on the GUI. Your GUI should use the following UI components:
- Edit Text
- Static Text
- Axes
- Push Button
Some components may be used several times.
'Part 3':
function projectile(x0,y0,V0x,V0y)
g = -9.8;
b = V0y;
a = g/2
c = y0;
t_flight = (-b-sqrt(b^2-4*a*c))/(2*a);
t = linspace(0,t_flight,100);
x = x0 + V0x.* t;
y = y0 + V0y.* t + (1/2) * g.* t.^2;
plot(x, y, 'b-', 'Linewidth', 3);
axis equal;
xlabel('Distance (m)');
ylabel('Height (m)');
title('Projectile Motion');
Comments
Leave a comment