Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Trapezoid Rule in Matlab Preparation: Use the help in Matlab to learn how to use the function feval Write a Matlab function which computes

image text in transcribed

4. Trapezoid Rule in Matlab Preparation: Use the help in Matlab to learn how to use the function feval Write a Matlab function which computes the integral by trapezoid rule. Your function should be used by the following command in Matlab command window >trapezoid('funItg',a,b,n) where fun1tg.m is the naine of the file of the function f(x), and a, b s the interval, and n is the number of sub-intervals (i.e., n+1 will be thember of points.) Test your function on problem 1. Write a script that computes for n -4,8, 16,32, 64, 128. Compute also the absolute error for each n, and make a plot of the absolute error against n. (Use loglog to plot. ) How does the error change when n is doubled? Do you expect this from the error estimate? Write your comments

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions