Write a MATLAB program that asks the user to enter a beginning time and an endin
ID: 1831729 • Letter: W
Question
Write a MATLAB program that asks the user to enter a beginning time and an ending time (both in seconds) that define an interval of time over which we want to plot the velocity and acceleration of the aircraft. Assume that a time of zerorepresents the point at which the power level was increased. The ending time should be less than or equal to 120 seconds.
Explanation / Answer
%Author Brijesh Gurung p=input(' Please input the begining time in seconds:'); %Asks user for ending time unless time less than 120 seconds is submitted j=input('Please input the ending time in seconds less than 120 seconds:'); while j>120 j=input('Please input the ending time in seconds less than 120 seconds:') end time=[0:p]; %computes the velocity at different time starting from rest velocity= 0.00001.*time.^3-0.00488.*time+ 181.356; %computes the Accelration depending on velocity acceleration=3- 0.000062.*velocity.^2 subplot(2,2,1) plot(time,velocity),title('Velocity vs Time') xlabel('Time') ylabel('Velocity') subplot(2,2,2) plot(time,acceleration),title('Acceleration vs Time') xlabel('Time') ylabel('Acceleration') % to find the velocity and acceleartion between the interval %specify the new time interval time=[p:j]; velocity= 0.00001.*time.^3-0.00488.*time+ 181.356; acceleration=3- 0.000062.*velocity.^2; subplot(2,2,3) %plots the graph from starting time point as p plot(time,velocity),title('Velocity vs Time') xlabel('Time') ylabel('Velocity') subplot(2,2,4) plot(time,acceleration),title('Acceleration vs Time') xlabel('Time') ylabel('Acceleration')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.