You must work either on your own or with one partner. If you work with a partner you must first register as a group in CMS

and then submit your work as a group. Adhere to the Code of Academic Integrity. For a group, “you” below refers to “your

group.” You may discuss background issues and general strategies with others and seek help from the course staff, but the

work that you submit must be your own. In particular, you may discuss general ideas with others but you may not work out

the detailed solutions with others. It is not OK for you to see or hear another student’s code and it is certainly not OK to

copy code from another person or from published/Internet sources. If you feel that you cannot complete the assignment on

you own, seek help from the course staff.

Objectives

Completing this project will solidify your understanding of 2-dimensional and 3-dimensional arrays. In Part A, you

will practice working with matrices, including the use of Matlab as a (black box) tool to solve a system of linear

equations. In Part B, you will practice working with 2-d and 3-d arrays through an image processing application.

1 The Ising Model

Complete parts (a), (b), and (c) of Problem P7.3.6 (p.176) in Insight. By initializing A and then repeatedly

applying the function Sweep, you now have a simple implementation of the Ising Model.

(d’) Our model describes a system in which each cell tends to have the same state as its neighbors, subject to random

fluctuations. And it turns out that these random fluctuations play a critical role in the long term behavior of the

model. To explore this behavior, write a script simIsing to generate a visual representation of the simulation as it

proceeds. Set n to be 50 and p to be 0.75; use built-in functions pcolor1 and pause for the visualization. At the

end of the script, provide a brief answer, in the form of program comments, to each of the following questions: (1)

What is the longterm behavior of the model when T=0? When T is small? When T is large? (2) What values of T

do you consider to be small/large? (3) In this model, T admits the physical interpretation of temperature. Are your

observations consistent with such an interpretation? (Hint: How do the phases of matter relate to temperature?)

Submit your files InitialIsing.m, Potential.m, Sweep.m, and simIsing.m on CMS.

2 System of Linear Equations

Systems of linear equations often arise from the modeling of systems of interconnected

elements. In your physics class you may have studied the force and acceleration on a

connected set of free-falling objects. Such a model gives a coupled set of equations that

must be solved simultaneously; the equations are coupled because the individual parts of

the system are influenced by other parts.

[Our objective for this problem is to show how you can use Matlab as a solver of systems

of linear equations. We do not expect you to know linear algebra nor are we trying to teach

linear algebra. We will use the solver as a “black box,” so your only real task is to turn

a set of given equations into a matrix and a vector and then use the solver, which is just

an operator. So there’s no need to be afraid of the physics or math! This discussion and

problem is adapted from Introduction to Computing for Engineers by Chapra and Canale.]

Consider a set of n linear algebraic equations of the general form

1pcolor(A) gives a visualization of the values in matrix A by associating a color with an individual numeric value in A, see Eg7 3 in

Insight. For this problem, do not use the additional options shading interp and caxis as shown in Eg7 3 since we do not want any

interpolation—we have only two possible values in our matrix in this problem. If you want to learn more about pcolor, type help pcolor

or doc pcolor at the Matlab Command Window.

1

Created in Master PDF Editor

a11x1+ a12x2+ . . . + a1nxn = b1

a21x1+ a22x2+ . . . + a2nxn = b2

. . . .

. . . .

. . . .

an1x1+ an2x2+ . . . + annxn = bn

(1)

where the a’s are known constant coefficients, the b’s are known constants, and the n unknowns, x1, x2, . . . , xn, are

raised to the first power. This system of equations can be expressed in matrix notation as

Ax = b

or

a11 a12 . . . a1n

a21 a22 . . . a2n

. . .

. . .

. . .

an1 an2 . . . ann

x1

x2

.

.

.

xn

#

b1

b2

.

.

.

bn

(2)

To solve this linear system of equations is to find the values x1, x2, . . . , xn such that Ax = b. In Matlab, the

solution can be found using the backslash, called the matrix left divide operator:

x = A\b (3)

where A is the n-by-n matrix of coefficients, b is the length n column vector of constants, and the result x is the

length n column vector of values such that Ax = b.

Your job: Write a script parachutes.m to find the acceleration h, force T, and force R experienced by a team

of three parachutists free-falling while connected by a weightless cord, as shown in the figure above. Suppose that

the parachutists are free-falling at a velocity (v) of 5 m/s, the acceleration due to gravity (g) is 9.8 m/s2

, and the

following values are given for the masses (m) and drag coefficients (d) of the parachutists:

Parachutist Mass, kg Drag Coefficient, kg/s

1 (bottom) 70 10

2 (middle) 60 14

3 (top) 40 17

The force-balance equations that define the relationships among the parachutists are

m1g − T − d1v = m1h

m2g + T − d2v − R = m2h

m3g + R − d3v = m3h

You need to do the following:

- Rewrite these equations in the general form of (1) by collecting terms together, where the unknowns are x1, x2,

and x3. I.e., the unknowns in our problem, h, T, and R, are x1, x2, and x3, respectively, in (1). This means

for each equation, re-arrange it so that the unknowns are on the left hand side while the constants are on the

right hand side. For example, the third force balance equation can be rearranged as follows:

m3g + R − d3v = m3h Original

m3h − R = m3g − d3v All unknowns moved to left side; all constants moved to right side

m3h + 0T − 1R = m3g − d3v Re-order left side by the 3 unknowns

The final rearranged equation should have all three unknowns on the left side; some of their coefficients may

be zero, as shown above. Do this rearrangement of each force equation by hand (on paper)—you do not need

to include this step in your script or submit it.

2

Created in Master PDF Editor - In your script, create the 3-by-3 matrix A—the coefficients of the 3 unknowns in the 3 equations—and the

length 3 column vector b—the constants on the right side of the re-arranged equations—as shown in (2). - Apply the matrix left division operator as shown in (3) to solve for x1, x2, and x3.
- Finally display the values of x1 through x3 neatly.

Note that in this problem, most of the work is done by hand and you will write very little code. However, make sure

that your script is cleanly commented and that the print output is clean and descriptive. For example, instead of

printing just the value of x1, print something like acceleration h is 7.4 m/s^2 . (The value shown here is wrong;

you will determine the actual answer through your code.)

Submit your file parachutes.m on CMS.

Part B of Project 4 will appear in a separate document. Both Parts A and B have the same due date.

3

Created in Master PDF Editor

Sample Solution