Question
need help finishing this problem. matlab
erf(x) = 2-1 e_pdt Vr Joe

Composte trapezoid rule (MATLAB trapz andlor cuntrapr tunctions) Three point Gauss-Legendre quadrature MATLABs builb-in inte
Your Function 11 function erfIntegral] = PA7_crfIntegration(x) [erfTrapezoid, erfGL3, 2 | 3 A = 2. /sqrt(pi) % constant value
erf(x) = 2-1 e_pdt Vr Joe
Composte trapezoid rule (MATLAB trapz andlor cuntrapr tunctions) Three point Gauss-Legendre quadrature MATLAB's builb-in integral function (Adaptive Gauss-Kronrod Quadrature) Write a function that receives the following single input 1. A column vector of one or more values at which el) is to be computed Your function should reburn the following outputs (in order, column vectors when input is a vector) 1. The estimate(s) for ert) caculated using composite trapezoid rule between 0 and each of the elements in x Evaluate the integrand at 0 and at the input s-values to compute y vaues for the traperoid r 2. The estimate(s) of er) caloulated using three point Gauss-Legendre quadrature Work by hand to develop the shted integrand (in serms of ) and use the appropriate constants and function evaluata The estimate(s) of erf) caculated using MATLABs buit-in integral function
Your Function 11 function erfIntegral] = PA7_crfIntegration(x) [erfTrapezoid, erfGL3, 2 | 3 A = 2. /sqrt(pi) % constant value outside of integral 4) Fox @(t) expC-(t)^2); % f(x) that is being integrated 5 integrat ionLimits(1) = θ = x(i); integrat ionLinits(1+1)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

function [erfTrapezoid,erfGL3,erfIntegral]=PA7_erfIntegration(x)
erfTrapezoid=[];
erfGL3=[];
erfIntegral=[];
f=@(x) (2/sqrt(pi))*exp(-x.^2);
c = [0.5555556 0.8888889 0.5555556]; % weight coefficients

xxx = [-0.774596669 0 0.774596669];


for i=1:length(x)
xx=linspace(0,x(i));
  
erfTrapezoid(i)=trapz(xx,f(xx));
erfIntegral(i)=integral(f,0,x(i));
yyy = (x(i))/2 + (x(i))/2 * xxx;

erfGL3(i) = (x(i))/2 * sum(c.*f(yyy));
end
erfTrapezoid=erfTrapezoid';
erfIntegral=erfIntegral';
erfGL3=erfGL3';
end

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
need help finishing this problem. matlab erf(x) = 2-1 e_pdt Vr Joe Composte trapezoid rule (MATLAB trapz andlor cu...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. Another approximation for integrals is the Trapezoid Rule: integral (a to b)f(x) dx ≈ ∆x/2...

    4. Another approximation for integrals is the Trapezoid Rule: integral (a to b)f(x) dx ≈ ∆x/2 (f(x_0) + 2f(x_1) + 2f(x_2) + · · · + 2f(x_n−2) + 2f(x_(n−1)) + f(x_n)) There is a built-in function trapz in the package scipy.integrate (refer to the Overview for importing and using this and the next command). (a) Compute the Trapezoid approximation using n = 100 subintervals. (b) Is the Trapezoid approximation equal to the average of the Left and Right Endpoint approximations?...

  • Problem 2 (hand-calculation): Consider the function f(x) tabulated in table 1. Apply improved trapezoid rule to estimat...

    Problem 2 (hand-calculation): Consider the function f(x) tabulated in table 1. Apply improved trapezoid rule to estimate the integral, If) J ) dz, by using the following number of subintervals, n (a) n-3. Use grid points at i0, 4, 8 and 12 (b) n- 6. Use grid points at i0, 2,4, 6, 8, 10 and 12 (c) n = 12, Use all grid points For each part, compute the integral, T(f) and the corresponding absolute error Er(f), and the error...

  • Need help with MATLAB, what code should be added to print the graph of the trapezoid rule code be...

    Need help with MATLAB, what code should be added to print the graph of the trapezoid rule code below? %%Matlab code for Question 5. syms X y intlx exp(x),0,2); %integration of x*exp(x) fprintf("htlntegration of x"2*exp(x) for [O 3] is %2.5f.\n,y) %Integration using Trapizoidal rule nn [100 1000]; for ii 1:2 a:0; b-3; %Integration limit ns-1:nn(i) integral Values-zeros(size(ns)); ourFunction-@(x) x.*2.*exp(x); for n-ns val(n)-trapizoidal (ourFunction,a,b,nn(i); end fprintf nlntegration of x 2*exp(x) using Trapizoidal rule for [O 3]\n') fprintf('1tTrapizoidal integration value for n-%d...

  • MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demo...

    MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demonstrates using instructor-provided and randomized inputs to assess a function problem. Custom numerical tolerances are used to assess the output. Simpson's Rule approximates the definite integral of a function f(x) on the interval a,a according to the following formula + f (ati) This approximation is in general more accurate than the trapezoidal rule, which itself is more accurate than the leftright-hand rules. The increased...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT