Computation for the Sciences:
Lab 6 :: cftool, for loops and functions
Using cftool
MATLAB's cftool tutorial is a good starting place. Here we'll work with population data.
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.
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 two Exercises to complete before you tackle the problems. You'll
add code to cs112_sat.m
, save a sat.cfit
curve fitting session, and write
ubbi.m
.
Click here for the Exercises.