hw02problem4

hw02problem4 - xlabel('Time in Seconds')...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% HW 2 Problem 4 - Matlab Plotting % Team Member Names* % Lab Division/Section % Today's Date % Calculation of the accelerations and disatnces for two supercars. % Input Section elapsed_time = [0 1 2 3 4 5 6 7 8 9 10]; % Elapsed Time in sec ferrari_vel = [0 32 45 55 63 71 77 84 89 95 100]; % Velocity of Ferrari in mph bugatti_vel = [0 37 54 64 75 84 91 100 105 112 119]; % Velocity of Bugatti in mph % Calculation Section elapsed_time_h = elapsed_time./3600; % Convert time to hours ferrari_accel = ferrari_vel./elapsed_time_h; %Instantaneous Average Acceleration - Ferrari bugatti_accel = bugatti_vel./elapsed_time_h; %Instantaneous Average Acceleration - Bugatti ferrari_dist = ferrari_vel.*elapsed_time_h; %Instantaneous Average Distance - Ferrari bugatti_dist = bugatti_vel.*elapsed_time_h; %Instantaneous Average Distance - Bugatti % Output Section %plot accelerations figure(1) plot(elapsed_time,ferrari_accel,'b') %Will accept time in seconds or hours
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: xlabel('Time in Seconds') ylabel('Acceleration in mph/h') hold on plot(elapsed_time,bugatti_accel,'r') hold off %plot distances figure(2) plot(elapsed_time,ferrari_dist,'b') xlabel('Time in Seconds') ylabel('Distance in Miles') hold on plot(elapsed_time,bugatti_dist,'r') hold off %Results % ferrari_accel = % % Columns 1 through 7 % % NaN 115200 81000 66000 56700 51120 46200 % % Columns 8 through 11 % % 43200 40050 38000 36000 % % % bugatti_accel = % % 1.0e+005 * % % Columns 1 through 9 % % NaN 1.3320 0.9720 0.7680 0.6750 0.6048 0.5460 0.5143 0.4725 % % Columns 10 through 11 % % 0.4480 0.4284 % % % ferrari_dist = % % Columns 1 through 9 % % 0 0.0089 0.0250 0.0458 0.0700 0.0986 0.1283 0.1633 0.1978 % % Columns 10 through 11 % % 0.2375 0.2778 % % % bugatti_dist = % % Columns 1 through 9 % % 0 0.0103 0.0300 0.0533 0.0833 0.1167 0.1517 0.1944 0.2333 % % Columns 10 through 11 % % 0.2800 0.3306 %...
View Full Document

Page1 / 2

hw02problem4 - xlabel('Time in Seconds')...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online