Question
1. Forecasting enrollments The following enrollment data is from Virginia Tech. It lists the total number of students, both undergraduate and graduate. Total enrollment at
1. Forecasting enrollments The following enrollment data is from Virginia Tech. It lists the total number of students, both undergraduate and graduate.
Total enrollment at Virginia Tech, 19791996
Year Number Year Number Year Number
1979 20414 1985 22044 1991 23912
1980 21071 1986 22345 1992 23637
1981 21586 1987 22702 1993 23865
1982 21510 1988 22361 1994 23873
1983 21356 1989 22922 1995 23674
1984 22454 1990 23365 1996 24812
a) To get a feeling for the data, enter the numbers of students in a vector called TOTAL. Then, issue the MATLAB command plot(TOTAL,o). This command will give a scatterplot of the sixteen data points. If you want the years listed on the horizontal axis, you can define the vector YEAR with the command YEAR = 1979:1996 and then use the plot command plot(YEAR, TOTAL,o). Note that the scatterplot indicates a general trend of increasing enrollments, but with enrollments that decrease from time to time.
b) Because it is such a common but important problem, MATLAB has commands that can be used to generate best least-squares polynomial approximations. In particular, given data vectors X and Y, the command A = polyfit(X, Y, n)gives the vector of coefficients for the best least-squares polynomial of degree n to the data. Given a vector of evaluation points T, the command POFT = polyval(A, T)will evaluate (at each point of T) the polynomial having a vector of coefficients given by A. Use the polyfit command A = polyfit(YEAR,TOTAL,1)to generate the coefficients for a linear fit of the data graphed in part a). Issue the hold command to hold the graph from part a). Generate the vector Y from Y=polyval(A,YEAR) and note that Y is the vector of values of the linear fit. Issue the command plot(YEAR,Y)to superimpose the graph of the linear fit on the scatterplot from part a).
c) In order to gain a feeling for how well the linear fit works as a forecasting tool, imagine that you do not know the enrollments for 1996 and 1995. Calculate the linear fit for the smaller set of data, the years 19791994, a set of 16 points. How well does the linear fit over these sixteen points predict the actual enrollment numbers for 1995 and 1996?
d) Use the linear fit calculated in part b) to estimate the year when enrollment can be expected to reach 30,000 and the year when enrollment should reach 35,000. How does a computer evaluate functions such as y = cos x or y = ex ? Exercises 25 illustrate how mathematical functions such as y = tan x are evaluated on a computer orcalculator. By way of introduction, note that the only operations a computer can actually perform are addition, subtraction, multiplication, and division. A computer cannot actually evaluate functions such as y = x or y = sin x; instead, whenever a number such as y =2.7 or y = sin 2.7 is requested, the computer executes an algorithm that yields an approximation of the requested number. We now consider some computer algorithms for approximating mathematical functions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started