0% found this document useful (0 votes)
35 views

Project Range MATLAB

The document describes a program that loads measured field data from a kids pitching machine, defines a formula to model the claim of 30mph pitches traveling 30 feet, and plots the measured and calculated data on a graph to compare them. The program extracts angle and distance measurements, calculates predicted distances based on the claim, and overlays a plot of the measured and predicted values.

Uploaded by

Thịnh Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Project Range MATLAB

The document describes a program that loads measured field data from a kids pitching machine, defines a formula to model the claim of 30mph pitches traveling 30 feet, and plots the measured and calculated data on a graph to compare them. The program extracts angle and distance measurements, calculates predicted distances based on the claim, and overlays a plot of the measured and predicted values.

Uploaded by

Thịnh Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Program purpose

Table of Contents
Start ..................................................................................................................................
Load in measured data .........................................................................................................
Copy of measured data ........................................................................................................
Extract & store in variables ..................................................................................................
Define arrays for calculations & graph ...................................................................................
Formula & calculation .........................................................................................................
Plot measured data + calculated results on one graph ................................................................
Publish code as a pdf via command window ............................................................................
This program's purpose is to compare measured field data on a popular
kid's pitching machine to a claim that the machine will deliver pitches
at 30 mph that travel 30ft.
The project task then is to load in the raw data from a mat file, code a
formula that represents the claim, and then compare the two by plotting
both on the same graph.

Start
clear, clc %clear workspace & command windows

Load in measured data


load ardata

Copy of measured data


ar = rangedata;

Extract & store in variables


angles = ar(1,:); %1st row angles 15 to 85 degrees
horizd=ar(2:end,:); %horizontal distances in remaining rows and
columns
avghd=mean(horizd); %average each col of distance trials, ft

Define arrays for calculations & graph


mph=30; %mph (30 mph claimed)
Vi=1.4667*mph; %ft/s, convert mph --> fps
g=32.2; %ft/s^2, acceleration due to gravity
gen_angles = 0 : 1 : 90; %row vector contains from 0 to 90 deg angles

Formula & calculation


s=Vi^2*sind(2*gen_angles)/g; %predicted range in feet

1
1
1
1
1
1
2
2

Program purpose

Plot measured data + calculated results on one


graph
plot(angles,avghd,'or') %plot of measured data only
hold on %Freezes the current plot to overlay additional plots
plot(gen_angles,s) %plot of calculated values
xlabel('angles in degrees') %x-axis label
ylabel('horizontal distance in feet') %y-axis label
title('Kid''s Pitching Machine: Predicted and Measured Values')
hold off
legend('Measured distances','Predicted distances') %add a legend

Publish code as a pdf via command window


Published with MATLAB R2016a

You might also like