by My Name
Student ID #
BASIC Computer Programming
Teaching Assistant: TA Name
Lab Partner: Their Name
This experiment was an exercise in programming in the BASIC language for scientific data analysis. The program read a data file of arbitrary length (up to 1000 data points), created a graph, then displayed and saved statistical results. The program was written in QuickBASIC version 4.5, which is a form of compiled BASIC (as opposed to interpreted BASIC).
Introduction & Theory
Computers allow flexible and automated analysis of data through the use of programs. These programs serve as instructions that tell the computer exactly what to do with input, how to do it, and what to output. In modern computer systems, programs are written (created) using other specialized programs, known as compilers or interpreters. These programming languages, as they're called, convert English statements into the ones and zeros that the computer understands. By entering sets of these specialized statements (called source code) into a compiler, a program is created.
Nearly all computer "bugs" are caused by programming errors. The programming languages are quite terse, and must follow a logical sequence. A misplace semicolon or forgotten command can cause the program to stray from the desired logical path. As an analogy, if you bake all the ingredients of a cake before mixing them together (instead of after), you'll get a jumbled mess as a result. Similarly, a programmer must pay strict attention to detail if the desired result is to be obtained.
The program was designed in accordance with a handout, Basic Computer Programming, that was given out in lab. A single data file was read by the program, analyzed, graphed, and resulting statistical information was saved to disk.
The following data points were used as input:
The slope and intercept of the best-fit line were found with the following formulas:
Using these formulas, the following results were obtained:
Best fit line
Coefficient of determination= 0.8410077
Coefficient of correlation= 0.9170647
Standard estimate of error= 1.111574
A graph of the data points and the best fit line may be found in the attached appendix.
The use of a QuickBASIC compiler allowed a program to be written that can analyze and plot up to 1000 data points nearly instantaneously. The limit of 1000 data points may be raised with minor adjustments to the source code. The limit was chosen because it is rare for more data to be analyzed at one time, and setting the limit too high may have prevented the program from running on some systems, as well as increasing the time it would take for the program to initialize. It is estimated (strictly from past experience) that this program should execute in 50k of memory or less.
Basic Computer Programming, a handout distributed during lab.
The internal help system of QuickBASIC was used to obtain details of command use.