SKILL ACTIVITY 3
WRITE COMMANDS FOR FOLLOWING USING MATLAB
Q1. Evaluate following double integratals
f = @(x,y) 2 .* x .* y
f = function_handle with value:
@(x,y)2.*x.*y
integral2(f,1,2,0,4)
ans = 24
f = @(x,y) x - y
f = function_handle with value:
@(x,y)x-y
integral2(f,0,2,-1,1)
ans = 4.0000
f = @(x,y) x + y + 1
f = function_handle with value:
@(x,y)x+y+1
integral2(f,-1,1,-1,0)
ans = 1
f = @(x,y) (1 - (x .^ 2 + y.^ 2) ./ 2)
f = function_handle with value:
@(x,y)(1-(x.^2+y.^2)./2)
integral2(f,0,1,0,1)
ans = 0.6667
f = @(x,y) 4 - y .^ 2
f = function_handle with value:
@(x,y)4-y.^2
integral2(f,0,3,0,2)
ans = 16.0000
f = @(x,y) (x.^2.*y - 2.*x.*y)
f = function_handle with value:
@(x,y)(x.^2.*y-2.*x.*y)
integral2(f,0,3,0,-2)
ans = 6.3796e-14
f = @(x,y) (y ./ ( 1 + x .* y))
f = function_handle with value:
@(x,y)(y./(1+x.*y))
integral2(f,0,1,0,1)
ans = 0.3863
f = @(x,y) (x ./ 2 + sqrt(y))
f = function_handle with value:
@(x,y)(x./2+sqrt(y))
integral2(f,0,4,1,4)
ans = 30.6667
f = @(x,y) exp(2 .* x + y)
f = function_handle with value:
@(x,y)exp(2.*x+y)
integral2(f,0,log(2),1,log(5))
ans = 3.4226
f = @(x,y) x .* y .* exp(x)
f = function_handle with value:
@(x,y)x.*y.*exp(x)
integral2(f,0,1,1,2)
ans = 1.5000
f = @(x,y) y.*sin(x)
f = function_handle with value:
@(x,y)y.*sin(x)
integral2(f,0,pi/2,-1,2)
ans = 1.5000
f = @(x,y) sin(x) + cos(y)
f = function_handle with value:
@(x,y)sin(x)+cos(y)
integral2(f,0,pi,pi,2*pi)
ans = 6.2832
f = @(x,y) log(x) ./ x .* y
f = function_handle with value:
@(x,y)log(x)./x.*y
integral2(f,1,exp(1),1,4)
ans = 3.7500
f = @(x,y) x .* log(y)
f = function_handle with value:
@(x,y)x.*log(y)
integral2(f,-1,2,1,2)
ans = 0.5794
f = @(x,y) ( y - x) ./ (x + y) .^ 3
f = function_handle with value:
@(x,y)(y-x)./(x+y).^3
integral2(f,0,2,0,1)
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
ans = -1.9815
f = @(x,y) ( y - x) ./ (x + y) .^ 3
f = function_handle with value:
@(x,y)(y-x)./(x+y).^3
integral2(f,0,1,0,2)
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
ans = 1.9815
xmin = @(y) 2 * y
xmin = function_handle with value:
@(y)2*y
f = @(x,y) exp(x .^2)
f = function_handle with value:
@(x,y)exp(x.^2)
integral2(f,0,1,xmin,4)
ans = 4.1323
ymin = @(x) x * 2
ymin = function_handle with value:
@(x)x*2
f = @(x,y) x .* cos(y) .^ 2
f = function_handle with value:
@(x,y)x.*cos(y).^2
integral2(f,0,3,ymin,9)
ans = 10.5717
xmin = @(y) y .^3
xmin = function_handle with value:
@(y)y.^3
xmax = @(y) 4 .* sqrt(2 .*y)
xmax = function_handle with value:
@(y)4.*sqrt(2.*y)
f = @(x,y) x .^2 .* y - x .* y .^ 2
f = function_handle with value:
@(x,y)x.^2.*y-x.*y.^2
integral2(f,0,2,xmin,xmax)
ans = -97.4315
xmax = @(y) 4 - y .^ 2
xmax = function_handle with value:
@(y)4-y.^2
f = @(x,y) exp(x .* y)
f = function_handle with value:
@(x,y)exp(x.*y)
integral2(f,0,2,0,xmax)
ans = 20.5648
ymax = @(x) x .^ 2
ymax = function_handle with value:
@(x)x.^2
f = @(x,y) 1 ./ (x + y)
f = function_handle with value:
@(x,y)1./(x+y)
integral2(f,0,1,0,ymax)
ans = 0.3863
xmin = @(y) y .^ 3
xmin = function_handle with value:
@(y)y.^3
f = @(x,y) 1 ./ (sqrt(x .^ 2 + y .^ 2))
f = function_handle with value:
@(x,y)1./(sqrt(x.^2+y.^2))
integral2(f,1,2,xmin,8)
ans = 0.8666
f = @(x,y) 6 .* y .^ 2 - 2 .* x
f = function_handle with value:
@(x,y)6.*y.^2-2.*x
integral2(f,0,1,0,2)
ans = 14.0000
f = @(x,y) sqrt(x) ./ (y .^ 2)
f = function_handle with value:
@(x,y)sqrt(x)./(y.^2)
integral2(f,0,4,1,2)
ans = 2.6667
f = @(x,y) x .* y.*cos(y)
f = function_handle with value:
@(x,y)x.*y.*cos(y)
integral2(f,-1,1,0,pi)
ans = 1.4225e-16
f = @(x,y) y .* sin(x + y)
f = function_handle with value:
@(x,y)y.*sin(x+y)
integral2(f,-pi,0,0,pi)
ans = 4.0000
f = @(x,y) exp(x-y)
f = function_handle with value:
@(x,y)exp(x-y)
integral2(f,0,log(2),0,log(5))
ans = 0.8000
f = @(x,y) x .* y .* exp( x .* y .^ 2)
f = function_handle with value:
@(x,y)x.*y.*exp(x.*y.^2)
integral2(f,0,2,0,1)
ans = 2.1945
f = @(x,y) (x .* y .^ 3) ./ (x .^ 2 + 1)
f = function_handle with value:
@(x,y)(x.*y.^3)./(x.^2+1)
integral2(f,0,1,0,2)
ans = 1.3863
f = @(x,y) y ./ ( x .^ 2 .* y.^ 2 + 1)
f = function_handle with value:
@(x,y)y./(x.^2.*y.^2+1)
integral2(f,0,1,0,1)
ans = 0.4388