Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem #1: Numerical Integration Background: You have been provided a matrix co

ID: 2249488 • Letter: P

Question

Problem #1: Numerical Integration Background: You have been provided a matrix containing the coefficients of various equations (one equation per row one coefficient per column) for curves which you must calculate the area under. For each curve, starting with one rectangle and incrementing by one for each subsequent calculation, use the Rieman Sum methods (left, right, and midpoint) to repeatedly calculate the three different areas until they satisfy a user-inputted percent difference. Follow the sample outputs shown for formatting guidelines and to see what your code should produce. Use the equations provided below for reference Right Riemann: Left Riemann: Midpoint Riemann: -a Areay Arean-1l10 % Change = 100 Arean-1 Note . Use the coefficients and the polyval command to develop the quations used. You program should work no matter the number of equations entered given in the data set. The number of equations equal the number of rows in the data set provided . The bounds for the Riemann Sums will be determined by user defined values, and should be the same for all three methods of any given curve, but may not be the same for different curves. The % difference should compare the nth rectangle area with the previously calculated (n-1 )th rectangle area. . The amount of rectangles needed to reach the desired percent difference will be different for all three Riemann Sums.

Explanation / Answer

function []=sofn
clear all

global x y z xx yy zz dx dy

dx=0.05;
x=0:dx:1;
dy=0.002;
dz=0.002;
y=0:dy:1;
z=0:dz:2;

xx=length(x);
yy=length(y);
zz=length(z);

s1=0;
for i=1:zz-1
s1=s1+0.5*dz*(z(i+1)*exp(inte1(z(i+1)))+z(i)*exp(inte1(z(i))));
end
s1

end

function s2=inte1(localz)
global y yy dy

if localz==0
s2=0;
else
s2=0;
for j=1:yy-1
s2=s2+0.5*dy*(inte2(y(j),localz)+inte2(y(j+1),localz));
end
end

end

function s3=inte2(localy,localz)
global x xx dx

s3=0;
for k=1:xx-1
s3=s3+0.5*dx*(2/(localy+localz));
end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote