Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4: (6 marks) Please modify the MATLAB file Gauss_2D_tut.m from Tutorial 10 to integrate an analytic function f(x, y)=x*ev, using 2D Gaussian quadrature. Call

image text in transcribed
image text in transcribed
image text in transcribed
Question 4: (6 marks) Please modify the MATLAB file Gauss_2D_tut.m from Tutorial 10 to integrate an analytic function f(x, y)=x*ev, using 2D Gaussian quadrature. Call this script Gauss_2D_tut_analytic.m You can use the same structure as Gauss_2D_tut.m but instead of a field, pass in a pointer to a function. Then fill in the table below for the following integral: SiL x*e" dxdy Gauss 2D # Gauss points 1x1 3x3 5x5 elfunction out = Gauss_2D_tut(a,b,c,d,N,M,A,X,Y) sfunction that integrates the field A using Gaussian integration % N,M : gauss points used along x and y. define Jacobian %YOUR CODE HERE % our gauss point library (file gw.m) contains coordinates defined in the 19,1] % interval. Therefore we use 2 variables ksi and eta defined in the [0,11 % interval which is equivalent to [a,b] for x and (c,d) for y coordinates. So that: % x=a+(b-a)*ksi; % y=C+(d-c)*eta; Shence Jacobian matrix: [d_x/d_ksi, d_x/d_eta; d_y/d_ksi, d_y/d_eta] % determinant of Jacobian matrix: J=det ( [(b-a), 0;0, (d-c)]); % define grid vectors [wx, ksig) = gw(N); [wy, etag] = gw(M); xg=a+ksig*(b-a); yg=c+etag*(d-c); [xxg, yyg] = ndgrid(xg, yg); [wwx, wwy] = ndgrid(wx, wy); ix = 1:N; iy = 1:M; %sample our image at interpolated grid points U = interp2(X,Y, A,xxg, yyg); s = sum( sum( U(ix, iy). *WWX. *wwy ) ); out=J*s; Question 4: (6 marks) Please modify the MATLAB file Gauss_2D_tut.m from Tutorial 10 to integrate an analytic function f(x, y)=x*ev, using 2D Gaussian quadrature. Call this script Gauss_2D_tut_analytic.m You can use the same structure as Gauss_2D_tut.m but instead of a field, pass in a pointer to a function. Then fill in the table below for the following integral: SiL x*e" dxdy Gauss 2D # Gauss points 1x1 3x3 5x5 elfunction out = Gauss_2D_tut(a,b,c,d,N,M,A,X,Y) sfunction that integrates the field A using Gaussian integration % N,M : gauss points used along x and y. define Jacobian %YOUR CODE HERE % our gauss point library (file gw.m) contains coordinates defined in the 19,1] % interval. Therefore we use 2 variables ksi and eta defined in the [0,11 % interval which is equivalent to [a,b] for x and (c,d) for y coordinates. So that: % x=a+(b-a)*ksi; % y=C+(d-c)*eta; Shence Jacobian matrix: [d_x/d_ksi, d_x/d_eta; d_y/d_ksi, d_y/d_eta] % determinant of Jacobian matrix: J=det ( [(b-a), 0;0, (d-c)]); % define grid vectors [wx, ksig) = gw(N); [wy, etag] = gw(M); xg=a+ksig*(b-a); yg=c+etag*(d-c); [xxg, yyg] = ndgrid(xg, yg); [wwx, wwy] = ndgrid(wx, wy); ix = 1:N; iy = 1:M; %sample our image at interpolated grid points U = interp2(X,Y, A,xxg, yyg); s = sum( sum( U(ix, iy). *WWX. *wwy ) ); out=J*s

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago

Question

=+ 4. Why should policymakers think about incentives?

Answered: 1 week ago

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago