14.19. Numeric Methods Homework¶
Save all of the commands entered into MATLAB and the output to a text file to submit on Canvas.
Use the
fzero
function to find where is equal to zero in the range .Use the following code to make 8 points. Then use the
interp1
function to expand the data to 32 data points. Generate a subplot with the smooth function, 8 point plot, 32 point plots with linear and pchip interpolation.>> f = @(x) cos(x) + 0.7*sin(x); >> x = linspace(-pi,pi,8); >> y = f(x); >> plot(x,y)
Using the trapezoid rule (20 subintervals), Simpson rule (20 subintervals), the adaptive integral algorithm presented in Recursive Adaptive Integral, and MATLAB’s
integral
function compute the definite integralUse the anonymous function
f = @(t,y) t.^2 .* exp(-t);
let , define a differential equation. Useode45
to plot , .