Final Exam:
MATLAB
Arrays, operations (arithmetic, relational)
programming structures: for/while loops, if.elseif.else.end
standard mathematical functions in MATLAB, scientific notation
creating MATLAB functions, for example
functions that sum a series, f
General formulation of interpolation: We are given a set of datapoints x i , y i , i 1, . . , n and want to find a function x that interpolates the data, i.e. we want x i y i , i 1, . . , n. We can an interpolant. We generally look for an interpolant from
(Note: When we talk about a vector below, we are generally thinking of a column vector,
and in MATLAB, as a column array)
If x represents a vector (in MATLAB it would just be a one dimensional array) then the sum
of the squares of the components of x is x
Notes on iteration and Newton's method Iteration Iteration means doing something over and over. In our context, an iteration is a sequence of numbers, vectors, functions, etc. generated by an iteration rule of the type x n1 f x n where f is some fixed fun
Recursive functions:
Functions that are defined in terms of themselves are called recursive functions, or
recursively defined functions. This is not as strange as it sounds - a number of well-known
functions can be defined in recursive form, and we are al
A little bit about colors in MATLAB: RGB specification of color: There is a standard system for specifying color, based on the fact that every color can be considered a combination of red, green, and blue. In this system each color is specified by the ord
Cellular automata We discuss cellular automata as a simple application of MATLAB programming and as an accessible scientific topic of recent interest. You can find a lot of information on the internet. In particular, you can visit the website of Wolfram's
Visualizing data in two and three dimensions/Graphing functions of 2 variables/Curves and Surfaces in 3-dimensions We discuss the following MATLAB commands:
plot3(x,y,z) pcolor(A) or pcolor(X,Y,Z) contour(Z) or contour(X,Y,Z) surf(Z) or surf(X,Y,Z) surfc(
Simulation
Simulation deals with systems which evolve in a probabilistic manner. In these systems,
probabilities are specified for certain outcomes (or each of a sequence of outcomes) and it
is desired to calculate mathematically, or estimate experimental
Math 222 Exam 1
Put your answers in a single MATLAB .m file, with the filename jonesexam1.m (if your last
name is Jones). Email it to me at [email protected] Efficiency counts. The usual
ground rules apply (no fancy MATLAB functions such as sum, flipl
Math 222 Final
Do any 9 problems. Do not use any "fancy" MATLAB functions such as
max,min,prod,sum,cumsum,sort, etc.
1. Given a matrix A, explain (using MATLAB commands) how to do the following
a) Find the number of rows and columns in A
b) Create a matri
Topics for exam 1
The test will be mostly using MATLAB to carry out specified tasks, but some explanations
are occasionally requested (why did that happen, what does this mean, why does this (not)
work, what would happen if, etc)
You should be familiar wi
Math 222
Exam 2
1. (4 pts) Consider the following MATLAB statements
[m,n] size(colormap);
image(m:-1:1)
colorbar
Explain what just happened, what you are looking at, and why.
There are two images in the figure - they look exactly the same except for their
Math 222 Exam 2
1. Consider the positive fixed points of the function f x 5 log x.
a) Find the approximation location of the fixed point(s) by graphing using MATLAB.
(Youll need to go out a ways)
b) Which fixed point(s) are stable and which are unstable?
Math 222 Exam 2
1. Create a random 20x20 matrix of integers from 1 to 6 and display the matrix and colorbar
using the following color map:
1
2
3
4
5
6
Red
Red/Green (using an even mixture of red and green, with no blue)
Green
Blue/Green (using an even mix
Practice problems for exam 2
1. Make a 20x20 random array containing integers 1,2,3 (and dont you dare use randi).
Display the array in an image, with 1 Red, 2 Green, 3 Blue.
2. Write in recursive form a matlab function s mysumr(x) that will find the sum
Topics for exam 2
Color in MATLAB
The image and imagesc commands. Reading values off an image with colorbar. Colors in
the rgb system.
Colormaps. How to set up your own color map, the white/black colormap.
Cellular automata - the basic idea: a series of c
Math 222 Exam 2
1. Consider the positive fixed points of the function f x 5 log x.
a) Find the approximation location of the fixed point(s) by graphing using MATLAB.
(Youll need to go out a ways)
b) Which fixed point(s) are stable and which are unstable?
Math 222 Exam 3
1. We wish to find a polynomial c 0
1, 2 , 1, 3 , 2, 1 .
c1x
c 2 x 2 to interpolate the x, y values
a) What system of equations is satisfied by c 0 , c 1 , c 2 - write it explicitly below.
b) Solve the system using MATLAB and write the pol
Review topics for exam 3
Interpolation
Polynomial interpolation, interpolation with other specified functions (e.g. even or odd
powers)
Interpolating from data: Plotting the interpolant and the data
Interpolating from functions: Plot the interpolant, the
Math 222 Exam 1
Instructions:
All of your work should be submitted in ONE Matlab M-file. The name of the file should
be of the form brownexam1.m if your last name is brown. (I dont want 25 files all named
brownexam1.m please.) You will need to email me th
Math 222 Exam 1
Directions: Create a single M-file with your answers, with file name smithexam1.m (where
you substitute your last name for smith). When you are done, drag the file onto the Math222
icon on the desktop. NOTE: There are two sides to the exam
Math 222 Exam 3
1. We are interested in the function f x
|x
1 | on the interval 0, 2 .
a) Interpolate f x on 0, 2 using a polynomial p x of degree 6 with equally spaced
interpolation points that cover the interval.
b) Plot the graph of p x , the datapoint
Math 222 Final Exam
1. Solve this system using MATLAB (yeah its easy):
2x y 3z 1
xy z 2
3x 4z 4
2. Create these arrays with a single expression using the colon operator
1 1 1 . 1
a)
99 2
12 32 52
1 . 1
16
2 10
b)
1
2
1
4
1
8
c)
1
2
3
4
5 .
6
99
100
3. If
Math 222 Hw3 Part 2
1) Let f x
6x x 2 2
a) Locate the fixed points of f graphically. Without running any iterations or solving for the
fixed points exactly, determine whether the fixed points are stable or unstable (you may use
their approximate location