Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Analyzing Matrices and Performance Levels in Education, Exams of Computer Science

A part of cs112 scientific computation course materials at wellesley college. It covers various matrix operations, indexing, and analyzing table data. The document also includes instructions on how to plot trends in performance levels and print changes in results. The data presented is related to the mcas test in mathematics, grade 10.

Typology: Exams

Pre 2010

Uploaded on 08/19/2009

koofers-user-lem
koofers-user-lem 🇺🇸

10 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CS112 Scientific Computation
Department of Computer Science
Wellesley College
Tables
More matrix fun
More matrices 7-2
Remember from last time…
We refer to individual locations of a matrix using
two indices that specify the row and column
nums = [ 1 2 3 4 5; 6 7 8 9 10; ...
11 12 13 0 15; 16 17 18 19 20];
val = nums(2, 3);
nums(3, 4) = 14;
val
1 2 3 4
6789
1234
1
2
nums
5
10
5
11
16
12
17
13
18
0
19
15
20
3
4
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Analyzing Matrices and Performance Levels in Education and more Exams Computer Science in PDF only on Docsity!

CS112 Scientific Computation

Department of Computer Science

Wellesley College

Tables

More matrix fun

More matrices 7-

Remember from last time…

We refer to individual locations of a matrix using

two indices that specify the row and column

nums = [ 1 2 3 4 5; 6 7 8 9 10; ... 11 12 13 0 15; 16 17 18 19 20]; val = nums(2, 3); nums(3, 4) = 14;

val

nums

More matrices 7-

Indexing with colon notation

To refer to anentire column of a matrix, provide : as the first index and the column number as the second index >> nums(:, 3) ans = 3 8 13 18

To refer to anentire row of a matrix, provide : as the second index and the row number as the first index >> nums(2, :) ans = 6 7 8 9 10

nums 5 10

More matrices 7-

Analyzing table data

level (^1998 1999 2000 2001 2002 2003 2004 ) advanced (^7 9 15 18 20 24 29 ) proficient (^17 15 18 27 24 27 28 ) needs improvement 24 23 22 30 31 29 28 24 failing (^52 53 45 25 25 20 15 )

Table 1. Statewide results for MCAS Test in Mathematics, Grade 10

More matrices 7-

Finally, ...

Suppose we want to print the change in results between 1998 and 2005 for each performance level…

How do we do this?

More matrices 7-

Printing changes in results

% print total change in results between 1998 and 2005 totalChange = results(:, end) - results(:, 1); disp('Change in performance between 1998 and 2005:‘); disp(['advanced: ' num2str(totalChange(1)) '%‘]); disp(['proficient: ' num2str(totalChange(2)) '%‘]); disp(['needs improvement: ' num2str(totalChange(3)) '%‘]); disp(['failing: ' num2str(totalChange(4)) '%‘]);

Change in performance between 1998 and 2005:

advanced: 28%

proficient: 10%

needs improvement: 0%

failing: -37%

More matrices 7-

Time-out exercise

For each year, compute aweighted sum of the four percentages, using a weight of 1 for “advanced”, 2 for “proficient”, 3 for “needs improvement” and 4 for “failing”* overallPerformance =

Add a new row to the results matrix that stores these weighted sums

  • The resulting sum can range from 100 (great!) to 400 (not so good…)

More matrices 7-

More indexing with colon notation

We can use colon notation to refer to arange of indices within a column or row of a matrix

>> nums(1:3, 4)

ans =

>> nums(3, 3:5)

ans =

>> nums(2:3, 2:4)

ans =

nums 5 10

More matrices 7-

Time-out exercise

Given the original ages matrix, write two statements that each assign the variable numAdults to the total number of age values that are 18 or over

One statement should use sum and the other should use length

More matrices 7-

Creating synthetic images

Using colon notation, we can create a synthetic image that contains patches of constant brightness image = zeros(128, 128); image(10:40, 50:80) = 1.0; image(60:100, 80:115) = 0.8; image(90:110, 30:100) = 0.4; Copy rectangular regions of one image into another image patch = image(60:110, 60:110); newImage = zeros(128,128); newImage(10:60, 10:60) = patch; newImage(10:60, 70:120) = patch; newImage(55:75, 55:75) = image(90:110, 70:90); newImage(85:120, 40:80) = newImage(40:75, 40:80);

More matrices 7-

Let’s make a quilt

Suppose we want to create the following image - How do we plan the code?

We can begin by making a single patch:

More matrices 7-

Making the patch

First draw a picture of the pattern, with coordinates of key points and brightness values:

Then write the code…

patch (^) 0.0 0.5 1.