Solutions for Geog 210C chris/Medrano_GEO 210C/GEO 210C - Spatial...Solutions for Geog 210C Lab Assignment

  • View
    212

  • Download
    0

Embed Size (px)

Text of Solutions for Geog 210C chris/Medrano_GEO 210C/GEO 210C - Spatial...Solutions for Geog 210C Lab...

  • Solutions for Geog 210C Lab Assignment #1

    STUDENT NAME: Antonio Medrano

    DATE COMPLETED: 4/10/08

    Contents

    Instructions

    Page #1: Preliminaries

    1/1: Just displaying stuff...

    1/2: Now it's your turn...

    1/3: Booleans

    1/4: For loops and basic statistics

    1/5: Sorting

    1/6: Median

    1/7: Logic

    1/8: More logic and logs

    2/1: Histograms

    2/2: Density Histograpms

    2/3: Gaussian Comparison

    2/4: Cumulative Distribution Function (CDF)

    2/5: Easy CDF plotting

    2/6: Gaussian CDF comparison

    2/7: Interpolation

    2/8: Quantiles

    Section 3 prep

    3/1: Stem plots

    3/2: Annotations

    3/3: Histogram Comparison

    3/4: Box Plots

    3/5: QQ-Plots

    3/6: more QQ-plots

    3/7: Gaussian comparison

    3/8: Printing graphs to files

    Instructions

    Copy this M-file into your working directory C:\Workspace, rename it as, say, lab01.m, and

    use it as a template, i.e., append the appropriate Matlab commands, to complete each Lab

    assignment.

    From Matlab, open this file using the Matlab Editor. DO NOT open this file by double

    clicking it with your mouse outside Matlab.

    Remember to enable cell mode in the Matlab Editor. A cell is a group of Matlab commands,

    whose start is designated with 2 percent signs %% You can highlight each cell by clicking on

    it with the mouse, and then evaluate/execute ONLY that cell (Control + Enter) as you

    proceed in completing your Lab assignment.

    Use a single percent sign % to include comments/answers in your M-file. Anything after (to

    the right of) % is treated as a comment, i.e., not considered a Matlab command.

    Solutions for Geog 210C Lab Assignment #1 file:///C:/Documents%20and%20Settings/Micah/My%20Documents/Doc...

    1 of 31 4/16/2009 2:23 PM

  • You could try to answer each Lab question in the Matlab command window. Once you have

    decided on the correct Matlab syntax, copy that command in your M-file for the

    corresponding Lab.

    Publishing to html:

    The completed M-file can be converted into an html file containing all your Matlab

    commands, comments, command output, and figures, using Matlab's publishing utility. This

    can be done using:

    File -> Publish to HTML

    and automatically creates a folder called html in your Matlab working directory. This folder

    contains the html file, as well as a suite of associated image files (.png files), if your M-file

    contains commands that produce graphical output, such as command plot. Note that you can

    also publish your M-file into other formats, such as pdf or Powerpoint; see File ->

    Publish To

    You can insert a variety of text formats in your M-file, using:

    Cell -> Insert Text Markup

    the differences between the above text formats are only visible in the published html file.

    For example, you can have a bulleted list with:

    boldface text

    italisized text

    monospaced text; this is typically reserved for Matlab commands

    What to turn in:

    For each Lab assignment, send an e-mail to the READER gargi@geog.ucsb.edu with:

    (i) a M-file containig the appropriate Matlab commands

    (ii) a .zip archive of the above html folder published via Matlab

    Collaboration is encouraged, but each student needs to submit his or her own M-file and

    .zip archive to the Reader

    Good luck, and remember to put your name at the top of this file...

    Phaedon C. Kyriakidis, April 2009.

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Page #1: Preliminaries 114.5/120

    Load the data file ithaca.dat with weather-related from the working directory

    load ithaca.dat

    % List variables in workspace

    who

    % More detailed listing of variables in workspace

    whos

    Solutions for Geog 210C Lab Assignment #1 file:///C:/Documents%20and%20Settings/Micah/My%20Documents/Doc...

    2 of 31 4/16/2009 2:23 PM

  • Your variables are:

    Fx fx meanTmax precip stdTmax

    FxG i medT propW tmax

    Gval2040 indN medTmax q2040 tmaxS

    ans indNW minT q2040Gauss tmin

    area indW minTmax qCGauss val

    binWidth10 ithaca minV qp2040 val2040

    boolW j myLabels qp2040Quant val2040Gauss

    c10 madP n10 quantG varP

    c15 madPrecip n15 relFreq10 varPrecip

    c20 maxT n20 relFreq15 x

    canandaigua maxTmax nDays relFreq20 x20

    covP maxV nVars sortTmax x40

    covPrecip meanCtmax numW stdCtmax xS

    d meanP p stdP ymax

    day meanPrecip p2040 stdPrecip

    days meanPrecipC p2040Gauss stdPrecipC

    densFreq10 meanPrecipI pq2040Gauss stdPrecipI

    Name Size Bytes Class Attributes

    Fx 18x1 144 double

    FxG 1x501 4008 double

    Gval2040 1x2 16 double

    ans 1x1 8 double

    area 1x1 8 double

    binWidth10 1x1 8 double

    boolW 31x1 31 logical

    c10 1x10 80 double

    c15 1x15 120 double

    c20 1x20 160 double

    canandaigua 31x4 992 double

    covP 1x1 8 double

    covPrecip 1x1 8 double

    d 1x31 248 double

    day 1x1 8 double

    days 1x31 248 double

    densFreq10 1x10 80 double

    fx 1x501 4008 double

    i 1x1 8 double

    indN 7x1 56 double

    indNW 5x1 40 double

    indW 15x1 120 double

    ithaca 31x4 992 double

    j 1x1 8 double

    madP 1x1 8 double

    madPrecip 1x1 8 double

    maxT 1x1 8 double

    maxTmax 1x1 8 double

    maxV 1x1 8 double

    meanCtmax 1x1 8 double

    meanP 1x1 8 double

    meanPrecip 1x1 8 double

    meanPrecipC 1x1 8 double

    meanPrecipI 1x1 8 double

    meanTmax 1x1 8 double

    medT 1x1 8 double

    medTmax 1x1 8 double

    minT 1x1 8 double

    minTmax 1x1 8 double

    minV 1x1 8 double

    myLabels 1x2 144 cell

    n10 1x10 80 double

    n15 1x15 120 double

    Solutions for Geog 210C Lab Assignment #1 file:///C:/Documents%20and%20Settings/Micah/My%20Documents/Doc...

    3 of 31 4/16/2009 2:23 PM

  • n20 1x20 160 double

    nDays 1x1 8 double

    nVars 1x1 8 double

    numW 1x1 8 double

    p 1x31 248 double

    p2040 1x2 16 double

    p2040Gauss 1x2 16 double

    pq2040Gauss 1x2 16 double

    precip 31x1 248 double

    propW 1x1 8 double

    q2040 1x2 16 double

    q2040Gauss 1x2 16 double

    qCGauss 1x31 248 double

    qp2040 1x2 16 double

    qp2040Quant 1x2 16 double

    quantG 1x31 248 double

    relFreq10