Sie sind auf Seite 1von 1

1.

For 𝑓(𝑥) = 𝑥 3 − 4 , perform 3 iterations of Newton’s method with starting point


𝑥0 = 2. Write a MATLAB script file using FOR-loop to compute the solution for this express.
Find the errors (compute the exact solution from calculator) and percentage errors of 𝑥0 , 𝑥1 , 𝑥2
and 𝑥3 .

2. Use WHILE-loop to modify your script file in Q1 so that the error percentage for 𝑥𝑛 does not
exceed 5%.

3. Enter: format long. Use the function 𝑓(𝑥) = 𝑥 5 − 7 with starting point 𝑥0 = 2. By trial
and error, what is the lowest value of n for which the program converges (stops changing).
Compute the error, which is how close the program’s answer is to the true value. Compute the
residual, which is the program’s answer plugged into 𝑓. Are the error and residual zero?

4. Write a script file to evaluate the following integral:


8
𝐸𝑣 = ∫ (3𝑥 2 − 1) d𝑥
2
where 𝑥 is the wavelength in cm. Estimate 𝐸𝑣 using Trapezoidal rule in MATLAB.

5. Derive the Taylor series expansion for 𝑓(𝑥𝑖+1 ) = 𝑒 𝑥 sin 𝑥 using a base point at 𝑥𝑖 = 0 and
𝑥𝑖+1 = 0.2. Write a MATLAB program which takes 𝑥𝑖 as input and computes the series for up
to 10th order.

6. Use WHILE-loop to modify your script file in Q5 so that the error percentage does not exceed
0.1%.

Das könnte Ihnen auch gefallen