Você está na página 1de 3

Gymnastics with MatLab 1. Root finding. Search the roots of this equation exp(-0.2x)sin(x+0.1x**2)=0 from the interval (0,10).

Plot a graph where you can see the roots. 2. Solve the following nonlinear system of equations. Try different values c. (Equation 1) arctan(1+xy)=x (Equation 2) x2+y2= c2 3. Introduction to numerical integration. Write a program which computes the integral of function f(t) over interval (A,B) using trapezoidal rule and dividing the interval into 20 subintervals. Use this to compute integral of f(t) = 2+sin(5t) +sin(6t2) over interval (0,5). Study what happens when you increase the number of intervals to 100. After this look for the Matlab commands for numerical integration. 4. Small animation. Create random functions f(x,t) = [sin(0.3x)]2 + 0.5sin(2x+t) + 0.2[1+rand()]sin(6x - t2) on interval x=(0,20) for times t=[0,10] by using time increment of 0.1. Plot the graph in the same frame so that you get a visual effect of simple animation. 5. Solving ODE:s by MatLab commands. a. Compute the numerical solution of differential equation with given initial conditions y'(t) = (1-0.2t)(20-y(t)) initial condition y(0)=10 This model describes an asymptotic change towards limit value 20, where the coefficient of change decreases b. Solve y'(t)= 0.02[10-y(t)][30-2y(t)] initial condition y(0)= 0 Equation describes the output/yield of a chemical reaction A + 2B --> C when the amount of A and B components initially are 10 and 30. y(t) is the amount of the final product C at time t. c. Solve y''(t)+(2-t)y'(t)-y(t)=sint with initial condition y(0)=0, y'(0)=1 This equation represents damped oscillation where the damping coefficient varies in time. 6. SIR model in epidemiology. Formulate a model where the variables are proportions of susceptible (S), infected (I) and recovered individuals (R) in the population. Simulate the time evolution of the system. 7. Solving linear system of equations, Ax=b. Generate a nonsingular 6x6 matrix A and 6x1 vector b. Solve x.

8 Solving an overdetermined system Ax=b. Generate 9x6 matrix A and 9x1 vector b. Find the best approximate solution (=least squares solution) for the equation Ax=b by solving the equation ATAx=ATb. 9. Solving multiple linear regression model. Data will be given at exercise session. 10. Fitting a polynomial of given degree k into a data set (xn, yn). Data will be given at exercise session. 11. Fitting a nonlinear function into a given data set. Data will be given at exercise session. 12. Creating a sample (n=100) from a distribution of given density function f(t). Density function will be given at exercise session. 13. Sampling from 2D distribution with density f(s,t). Density function will be given at exercise session. 14. Define a two player game with 3 or 4 moves. Write a program that simulates the game for given strategies and computes statistics for the payoff for both players. 15. Write a program that computes a filtered image of a digital image. Your image is a matrix of pixels, size 1000x1000. Try different equations for filters. 16. Write a program that creates a simulation of ARMA(1,3) time series model for time interval [0,50]. 17. Create a bounded random walk process w(t) with values on interval [-1,1] . Let a(k) be a sequence of independent normal random variables n(0,1). Choose stepsize parameter h ( 0<h<0.2) and a scale parameter d ( 0<d<1). Create a random function w(t) defined on interval [0,100] at discrete point t=0,h,2h,...,kh,..., as follows w(0) = 0 w(k+h) = w(k) +da(k) if w(k)+da(k) is in interval (-1,1) and w(k+h) =w(k) otherwise 18. Study the following differential equation with random forcing term y'(t) = (1-0.2t)(20-y(t)) + aw(t) with initial condition y(0)=10 Here w(t) is a bounded random walk in interval [-1,1] and a is a parameter. Derive the numerical solution of the differential equation in interval [0,100] using the simple numerical scheme y(t+h) =y(t) + y'(t)h

The solution path is stochastic. Generate 20 (or 100?) realizations in the same frame to show the variability.

Você também pode gostar