
Patrice Koehl 
Modeling and Data Analysis in Life Sciences: 2016Lab2: Graphing and ProgrammingWith this lab, you will practice some programming as well as to more graphing HandoutsGraphing and Programming:
Word document (click to download) or PDF document (click to download) Exercise 1: Checking if a matrix is magicA magic square is a square that produces the same sum, when its elements are added rowwise, columnwise or diagonally (both main diagonal and antidiagonal). A matrix is magic if it represents a magic square. For example,
is a magic matrix with sum = 34. Write a small program that checks if a matrix of any size is magic. Exercise 2: Challenge: sum of Fibonacci numbersRemember the Fibonacci sequence from Lab 1. As a reminder, it is defined as follows: Write a MATLAB script that computes the sum of the Fibonacci numbers F_{n}, for n between 1 and a given number N, with F_{n} being a multiple of 2 or 5. For example, when N = 5, only F_{3} and F_{5} are multiples of 2 or 5, and the sum is: S = F_{3} + F_{5} = 7. Check your program for N = 10, 15, 20, and 30 (in which cases S = 104, 858, 10207, and 1171004). Exercise 3: Analyzing biological dataA simple experiment was designed to analyze the effects of noise on gene expression within a cell: a cell has been engineered to contain two genes (which we will label as C and Y) that are supposed to be expressed identically. In the presence of noise however, the expression levels will differ. There are two possible source of noise:
Two different experiments were conducted, each with a different type of cell. In experiment 1, data (i.e. expression levels for C and Y) were collected for 30 cells, while in experiment 2, data were available for 37 cells. The raw data are in the two files: Data_exp1.dat Data for experiment 1Data_exp2.dat Data for experiment 2 (In each file, the first and second columns correspond to the expression levels of C and Y, respectively). Write a Matlab script for analyzing these data:
You will use the formula:
$$\eta_{int}^2 = \frac{\left \langle (cy)^2 \right \rangle}{2\langle c \rangle \langle y \rangle} \quad \quad \eta_{ext}^2 = \frac{\langle cy \rangle  \langle c \rangle \langle y \rangle}{\langle c \rangle \langle y \rangle} \quad \quad \eta_{tot}^2 = \frac{\langle c^2 + y^2 \rangle  2\langle c \rangle \langle y \rangle}{2 \langle c \rangle \langle y \rangle}$$
