Question: 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

 This is done in Matlab --------------------------------------------------------------------------------------------------------------------------- this is my previous program

This is done in Matlab

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

Problem 2: (i) Modify your previous programs such that Ivalue= myintegral|xg,wg,'myfunc') wouldcompute the same value Ivalue. You must use the Matlab command fevalto call myfunc inside myintegral.m (ii) Run your new programs and printIvalue. C: Users jacob Documents MATLAB Editor - C:\Users\jacob\Documents\MATLAB\myfunc.m myfunc.m xmyintegral.m X

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!