"Function" & "fprintf" Help Please (thanks in advance for everyone's time)
Show older comments
This code works as it is, however the problem statement wanted me to write a function (not a simple script file) and to use the fprintf command to output the values.
My question is, why does this function work even if I commment out the entire function?
Also, how in the world do I implement the command "fprinf"?
Any help would be much appreciated!
% Measures velocity of derby car
% Problem Statement: This function analyzes the data of a pine wood derby car
%
function[totalavgv,maxavgv,minavgv]=stowers_colbi_PA1(timeinterval,velocitydata);
timeinterval=input('Enter Time Intervals as a row vector in seconds[a b c]: ');
velocitydata =input('Enter Velocity Data as a two dimensional array (matrix) in inches per second [a b c; d e f]: ');
avgv = mean(velocitydata);
totalavgv=mean(avgv);
maxavgv= max(avgv);
minavgv= min(avgv) ;
plot(avgv,timeinterval,'+');
grid on
title('Average Velocity as Function of Time');
xlabel('Averae Velocity [in/sec]');
ylabel('Time Intervals [sec]');
end
Accepted Answer
More Answers (0)
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!