Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is done in Matlab --------------------------------------------------------------------------------------------------------------------------- this is my previous program Problem 2: (i) Modify your previous programs such that Ivalue= myintegral|xg,wg,'myfunc') would compute the

image text in transcribed

This is done in Matlab

---------------------------------------------------------------------------------------------------------------------------

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

this is my previous program

Problem 2: (i) Modify your previous programs such that Ivalue= myintegral|xg,wg,'myfunc') would compute the same value Ivalue. You must use the Matlab command feval to call myfunc inside myintegral.m (ii) Run your new programs and print Ivalue. C: Users jacob Documents MATLAB Editor - C:\Users\jacob\Documents\MATLAB\myfunc.m myfunc.m xmyintegral.m X myscript.m X + function f=myfunc(x, y) 2- f=x^2+y^2; 3 end 1 1 C: Users jacob Documents MATLAB Editor - - C:\Users\jacob\Documents\MATLAB\myintegral.m myfunc.m myintegral.m x myscript.m X + function II=myintegral (xg, wg) 2 - ng=length (xg); 3- II=0; 4 for i=1:ng 5- for j=1:ng 6- II=II+myfunc(xg(i),xg (j)) *wg (i) *wg (j); 7 end 8 end - | 9 10 C: Users jacob Documents MATLAB Editor - C:\Users\jacob\Documents\MATLAB\myscript.m myfunc.m X myintegral.m myscript.mx + xg=[0, -0.77459666924148343, 0.77459666924148343]; wg=[0.8888888888888888, 0.5555555555555556, 0.5555555555555556]; Ivalue=myintegral(xg, wg) 1 | | | Command Window >> myscript Ivalue 11 2.6667 fx >> Problem 2: (i) Modify your previous programs such that Ivalue= myintegral|xg,wg,'myfunc') would compute the same value Ivalue. You must use the Matlab command feval to call myfunc inside myintegral.m (ii) Run your new programs and print Ivalue. C: Users jacob Documents MATLAB Editor - C:\Users\jacob\Documents\MATLAB\myfunc.m myfunc.m xmyintegral.m X myscript.m X + function f=myfunc(x, y) 2- f=x^2+y^2; 3 end 1 1 C: Users jacob Documents MATLAB Editor - - C:\Users\jacob\Documents\MATLAB\myintegral.m myfunc.m myintegral.m x myscript.m X + function II=myintegral (xg, wg) 2 - ng=length (xg); 3- II=0; 4 for i=1:ng 5- for j=1:ng 6- II=II+myfunc(xg(i),xg (j)) *wg (i) *wg (j); 7 end 8 end - | 9 10 C: Users jacob Documents MATLAB Editor - C:\Users\jacob\Documents\MATLAB\myscript.m myfunc.m X myintegral.m myscript.mx + xg=[0, -0.77459666924148343, 0.77459666924148343]; wg=[0.8888888888888888, 0.5555555555555556, 0.5555555555555556]; Ivalue=myintegral(xg, wg) 1 | | | Command Window >> myscript Ivalue 11 2.6667 fx >>

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago