In: Computer Science
Create a GUI matlab code that computes for the position, velocity, and acceleration of the equation and displays their respective graph.
Hello dear student..your question looks a bit incomplete because you have not specified which equation to use or something like that. So as far as i understood, i have given you the answer of finding velocity , position and acceleration at different time intervals and displaying their respective graphs.
Do hit LIKE if you find the answer useful because that shows your love and support which motivates us. If you have any doubts, do ask in the comments below :-
Here starts your code :-
clear all
close all
clc
% initialize time interval
k = 1;
% define time vector
t = 0:k:10;
% define acceleration vector
a = [0,2,4,7,11,17,24,32,41,48,51];
% calculate the velocity
v = cumtrapz(t,a);
d = cumtrapz(t,v);
% display a table of the velocity values
tv = table(t(:),v(:),'VariableNames',{'Time_Sec'
'Velocity_mps'})
% display a table of the displacement values
td = table(t(:),d(:),'VariableNames',{'Time_Sec'
'Displacement_m'})
%plot graph of the change of the acceleration with time
plot(t,a)
title('Acceleration against time Graph')
xlabel('Time(Sec)')
ylabel('Acceleration(m/s^2)')
%plot graph of the change of the velocity with time
figure(2)
plot(t,v)
title('Velocity against time Graph')
xlabel('Time(Sec)')
ylabel('Velocity(m/s)')
%plot graph of the change of the displacement with time
figure(3)
plot(t,d)
title('Displacement against time Graph')
xlabel('Time(Sec)')
ylabel('Displacement(m)')
Thankyou!