Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Write a function numerical_integration() in MATLAB that can perform numerical integration. It should intake the following inputs: 1. a vector of x-axis values

image text in transcribed
Question 1 Write a function numerical_integration() in MATLAB that can perform numerical integration. It should intake the following inputs: 1. a vector of x-axis values representing the range over which we are integrating, for instance, [0.0.01:40] if we are integrating over the range 0 to 40 with a d-step of 0.01. 2. the derivative function over the given x-axis values. 3. the initial condition for the first value of the integral. 4. the step size of the numerical integral (the d-step used in x-axis vector) 5. the analytical solution for the integral over the given x-axis values Your function should compute the numerical integral and return it, in addition to plotting it. So for instance, if: 1.xis (-2'pi:0.01:2'pi) 2. derivative function is cos(x) 3. initial condition is o 4. step size of 0.01 5. analytical value is sin(x) Then we run: X y -2pit0.01:2-pi; numerical_integration(x, cos(x), 0, 0.01, sin(x)); We should see a figure pop up and y should be a numerical estimation of sinx). Submit your function m-file here. Upload Choose a File Question 1 Write a function numerical_integration() in MATLAB that can perform numerical integration. It should intake the following inputs: 1. a vector of x-axis values representing the range over which we are integrating, for instance, [0.0.01:40] if we are integrating over the range 0 to 40 with a d-step of 0.01. 2. the derivative function over the given x-axis values. 3. the initial condition for the first value of the integral. 4. the step size of the numerical integral (the d-step used in x-axis vector) 5. the analytical solution for the integral over the given x-axis values Your function should compute the numerical integral and return it, in addition to plotting it. So for instance, if: 1.xis (-2'pi:0.01:2'pi) 2. derivative function is cos(x) 3. initial condition is o 4. step size of 0.01 5. analytical value is sin(x) Then we run: X y -2pit0.01:2-pi; numerical_integration(x, cos(x), 0, 0.01, sin(x)); We should see a figure pop up and y should be a numerical estimation of sinx). Submit your function m-file here. Upload Choose a File

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

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions