MIT6_094IAP10_assn03

MIT6_094IAP10_assn03 - Jan. 27, 2010 Homework 3 6.094:...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Jan. 27, 2010 Homework 3 6.094: Introduction to Matlab Homework 3 This homework is designed to give you practice writing functions to solve problems. The problems in this homework are very common and you will surely encounter similar ones in your research or future classes. As before, the names of helpful functions are provided in bold where needed. Homework must be submitted before the start of the next class. What to turn in: Copy the text from your scripts and paste it into a document. If a question asks you to plot or display something to the screen, also include the plot and screen output your code generates. Submit either a *.doc or *.pdf file. Keep all your code in scripts/functions. If a specific name is not mentioned in the problem statement, you can choose your own script names. 1. Linear system of equations. Solve the following system of equations using \ . Compute and display the error vector 3 a + 6 b + 4 c = 1 a + 5 b = 2 7 b + 7 c = 3 5 2. Numerical integration. What is the value of: xe x /3 dx ? Use trapz or quad . Compute and 0 display the difference between your numerical answer and the analytical answer: 24 e 5/3 + 9 . 1 2 3. Computing the inverse. Calculate the inverse of and verify that when you multiply the 3 4 original matrix by the inverse, you get the identity matrix ( inv ). Display the inverse matrix as well as the result of the multiplication of the original matrix by its inverse. 4. Fitting polynomials . Write a script to load the data file randomData.mat (which contains variables x and y ) and fit first, second, third, fourth, and fifth degree polynomials to it. Plot the data as blue dots on a figure, and plot all five polynomial fits using lines of different colors on the same axes. Label the figure appropriately. To get good fits, you’ll have to use the centering and scaling version of polyfit (the one that returns three arguments, see help ) and its counterpart in polyval (the one that accepts the centering and scaling parameters). It should 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Jan. 27, 2010 Homework 3 6.094: Introduction to Matlab look like this: Polynomial fits to noisy data -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 Y Data Order 1 Order 2 Order 3 Order 4 Order 5 100 110 120 130 140 150 160 170 180 190 200 X 2
Background image of page 2
Jan. 27, 2010 Homework 3 6.094: Introduction to Matlab 5. Hodgkin-Huxley model of the neuron. You will write an ODE file to describe the spiking of a neuron, based on the equations developed by Hodgkin and Huxley in 1952 (they received a
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

MIT6_094IAP10_assn03 - Jan. 27, 2010 Homework 3 6.094:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online