Write a Matlab script-file probl1.m to execute the requested commands (as much as possible) in the...

50.1K

Verified Solution

Question

Advance Math

Write a Matlab script-file probl1.m to execute the requestedcommands (as much as possible) in the exercises below. Increase N anumber of times according to N = 4, 8, 16, 32, 64, 128, . . . (1)Determine for each N the (exact) error. (2) Determine for N ? 16also the convergence ratio q(h/2).

This script should be based on a function-file trap.m(trapezoidal integration) as follows:

function [totarea] = trap(N)

format long;

a = 0; b = 1/2; h = (b-a)/N;

x = a:h:b; totarea = 0;

for i = 1:N

xl = x(i);

xr = x(i+1);

fxl = myfunct(xl);

fxr = myfunct(xr);

locarea = (h/2)*(fxl+fxr);

totarea = totarea + locarea;

end

end

You can refer to the integral as myfunct(). The interval is[0,1/2].

Answer & Explanation Solved by verified expert
4.0 Ratings (707 Votes)
Matlab code for Trapizoidal methodclear allclose allMatlab code for Trapizoidal integral for varing Nn4 8 16 32 64    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students