CS112: Lab 6 :: cftool, for loops and functions

Using cftool

MATLAB's interactive curve fitting tutorial is a good place to start. Type cftool in MATLAB's command window. Then type load census to load in some data (that is predefined in MATLAB). We'll work through the highlights of the tutorial to learn how to use the Curve Fitting Toolbox.

Here is an informative page on goodness of fit measures .

Practice with for loops and functions

Write a function called starline that produces a string of asterisks as specified by user input. The header of the function will look like this:

function stars = starline(len)

Here are some sample executions of starline:

>> bar8 = starline(8)
bar8 =
>> bar4 = starline(4)
bar4 =
>> singlestar = starline(1)
singlestar =
>> nostar = starline(0)
nostar =
>> negativestar = starline(-2)
negativestar =

Prelude to Assignment 4

Assignment 4 contains one exercise and two problems to complete. For the exercise, you'll write your own MATLAB function, spin.m. Click here for the exercise.

Uploading your saved work

Use Fetch to upload your saved work.
Work-in-progress should go into your personal cs112/ folder.