Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab please TRAPEZOIDAL INTEGRATION PROGRAM (example of a function of a function) We now construct an m-file to do trapezoidal integration. % This program estimates

Matlab please image text in transcribed
TRAPEZOIDAL INTEGRATION PROGRAM (example of a function of a function) We now construct an m-file to do trapezoidal integration. % This program estimates area under curve using trapezoids % using a specified n number of trapezoids, over the limits a to b, the function is func! >> type area 1 function y = area 1 (func, a, b, n) total = 0; base = (b-a); for k = 2:n xk = a + base* (k-1); total = total + feval(func, xk); end y = 0.5.* base.* (feval (func, a) + 2.0.* total + feval(func, b)); Recall function humps >>type humps function y = humps(x) % Humps(x) is a function used by QUADDEMO and ZERODEMO. Y = 1./((x-.3).^2 + .01) + 1 ./((x-.9).^2 + .04) - 6; a) write a short m-file that will call upon the function and integrate it from 0 to 1 both by first constructing of function area 1.m as above, using 100 trapezoids and then calling on the built in quad function to get the area. b) The also plots humps from 0 to 1 very finely with 100 values of x. Integration fun. a. set up a function file for y(x) = 34 exp(-0.2x) sin(3x + pi/8) call it whatever you want. In one m-file do the following b. Integrate this function from 0 to 30 using the quad()functions. c. use area 1() to integrate this function. d. Plot the function over the interval in steps of 0.01: Do a rough estimate of the area from the plot. e. Compare the integrations over the same interval. Which is probably the best answer. Why? Or why not

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Evaluate the limit, if it exists. x2-6x + 5 lim 5 5x 6 lim lim

Answered: 1 week ago