Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

function [trap,h ] = trapezoidrule(fun,a,b,N); format long h =(b-a)/N; trap = (fun(a)+fun(b))/2; x = a + h.*(1:N-1); trap = trap + sum(fun(x)); trap = h*trap;

image text in transcribedimage text in transcribed

function [trap,h ] = trapezoidrule(fun,a,b,N);

format long

h =(b-a)/N;

trap = (fun(a)+fun(b))/2;

x = a + h.*(1:N-1);

trap = trap + sum(fun(x));

trap = h*trap;

this function is given.

How do I set up matlab code to get the loglog graph?

MACM 316 - Computing Assignment 7 Due Date: Monday March 26th, at 11pm. You must create ONE pdf file that contains the following: Page1 will be your report - the TA will only read and mark page 1 - if there is additional writing on any other page, it will be ignored and you will get no credit for it. Pages two (and maybe 3) will be your Matlab code that you used in the assignment. The TA may choose to run this code if your report does not match the code you submit. You will get a Crowdmark link that will allow you to upload your completed assignment.The assignment is due at 11:00pm. I have set the due time in Crowdmark to 11:05pm and if Crowdmark indicates that you submitted late, you will be given 0 on the assignment. Your computing report portion of your submission must be exactly 1 page. . Please read the Guidelines for Assignments first. . Keep in mind that Canvas discussions are open forums. . Acknowledge any collaborations and assistance from colleagues/TAs/instructor Computing Assignment - Trapezoidal rule Required submission: 1 page PDF document and Matlab code uploaded to Crowdmark. Consider a partition z0,..., zN of an interval a, b. For an integrable function f defined in the interval a, bl, the trapezoidal rule for the integral of f is 1 In general, the distance between consecutive points in the partition of [a, b] does not have to be the same. When, this partition consists of equally-spaced points, we have the formula k-1 The goal of this assignment is to investigate the rate of convergence of this rule depending on the functions we want to integrate. To do this, first download from Canvas the MATLAB function that implements the trapezoidal rule. It has the following inputs: lower and upper bounds of the interval, number of points in the partition, and the function you want to integrate. To test the function, compute the integral of the function f(x)ver ,1 with N 100 points. What is the value you get? Consider the intervals 11 0, and I2[0,2]. Approximate the integrals over both 1 and I2 of the functions fi sin(^r), f2(x) sin(2r), and fa(r) cos() by using the Trapezoidal rule. Then plot the absolute error of the computed integral and its corresponding true value. Note that the true values can be easily computed by hand. Also, find the rate of convergence at which each error is going to zero. Which one is the fastest? Note that one error plot is always close to machine epsilon, what do you think is causing this extreme accuracy? This last question is difficult - you should use an internet search to try and get some information on what is happening and perhaps why. Your conclusions should be explained in a one-page report. Your report must include the following

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago