I. Differentiation Under Integral Sign
%using symbolic math toolbox
syms x
a = 2
a = 2
f = (x^a - 1)/log(x)
f = 
int(f,0,1)
ans = 
eval(ans)
ans = 1.0986
% using numeric math toolbox
clear
f = @(x,a) (x.^a - 1)./log(x)
f = function_handle with value:
@(x,a)(x.^a-1)./log(x)
integral(@(x) f(x,2),0,1)
ans = 1.0986
%using symbolic math toolbox
syms x
a = 4
a = 4
f = 1/(x^2 + a^2)
f = 
int(f,0,Inf)
ans = 
eval(ans)
ans = 0.3927
% using numeric math toolbox
clear
f = @(x,a) 1./(x.^2 + a^2)
f = function_handle with value:
@(x,a)1./(x.^2+a^2)
integral(@(x) f(x,4),0,Inf)
ans = 0.3927
%using symbolic math toolbox
syms x
m = 3
m = 3
f = (x^m)
f = 
int(f,0,1)
ans = 
eval(ans)
ans = 0.2500
% using numeric math toolbox
clear
f = @(x,m) (x.^m)
f = function_handle with value:
@(x,m)(x.^m)
integral(@(x) f(x,3),0,1)
ans = 0.2500
%using symbolic math toolbox
syms x
a = 2
a = 2
f = log(1+a*cos(x))
f = 
int(f,0,pi)
ans = 
eval(ans)
ans =
0.0000 + 3.2899i
% using numeric math toolbox
clear
f = @(x,a) log(1 + a .* cos(x))
f = function_handle with value:
@(x,a)log(1+a.*cos(x))
integral(@(x) f(x,2),0,pi)
ans =
0.0000 + 3.2899i
%using symbolic math toolbox
syms x
a = 5
a = 5
f = exp(-x) * sin(a*x) / x
f = 
int(f,0,Inf)
ans = 
eval(ans)
ans = 1.3734
% using numeric math toolbox
clear
f = @(x,a) exp(-x) .* sin(a .* x) ./ x
f = function_handle with value:
@(x,a)exp(-x).*sin(a.*x)./x
integral(@(x) f(x,5),0,Inf)
ans = 1.3734
II. Trace the following curves:
Cartesian Explicit Curves: (Use ezplot for cartesian curves)
Note: Assume suitable value for constants given in equation
clear
f = @(x,y,a) a .^ 2.* y .^ 2 - x .^2 .* (2 * a - x) .* (x - a)
f = function_handle with value:
@(x,y,a)a.^2.*y.^2-x.^2.*(2*a-x).*(x-a)
ezplot(@(x,y)f(x,y,3))
% To plot curve with different limits thn given default limit of -2pi to 2pi, use following
ezplot(@(x,y)f(x,y,3),[-3*pi 3*pi])
% title, xlabel,ylabel and legend functions can be used to give title to graph,
% label X-axis and Y-axis, and show legends respectively.
% This can be applied to all other types of curves too.
xlabel('X-axis values in range -2pi to 2pi')
ylabel('Y-axis values in range -2pi to 2pi')
title('Cartesian Explicit Curves')
legend('eqn1')
f = @(x,y,a) a .^ 2.* x .^ 2 - y .^2 .* (2 * a - y)
f = function_handle with value:
@(x,y,a)a.^2.*x.^2-y.^2.*(2*a-y)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) a * y .^ 2 - 4 .* (x .* 2 * a)
f = function_handle with value:
@(x,y,a)a*y.^2-4.*(x.*2*a)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) y .^ 2 .*(a - x) - (x .^ 3)
f = function_handle with value:
@(x,y,a)y.^2.*(a-x)-(x.^3)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) 3 .* a * y .^ 2 - x .* (x - a) .^ 2
f = function_handle with value:
@(x,y,a)3.*a*y.^2-x.*(x-a).^2
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) a ^ 2 * y .^ 2 -x .^ 2 .* (a .^ 2 - x .^ 2)
f = function_handle with value:
@(x,y,a)a^2*y.^2-x.^2.*(a.^2-x.^2)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) y .* (x .^ 2 - 1) - (x .^ 2 + 1)
f = function_handle with value:
@(x,y,a)y.*(x.^2-1)-(x.^2+1)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a,b) (x.^2 - a.^ 2) .* (y.^2 - b .^ 2) - (a ^2 * b^2)
f = function_handle with value:
@(x,y,a,b)(x.^2-a.^2).*(y.^2-b.^2)-(a^2*b^2)
ezplot(@(x,y) f(x,y,2,3))
f = @(x,y,a) x .^ 2 .* (x .^ 2 - 4 .* a .^ 2) - y .^2 .* (x.^ 2 - a^2)
f = function_handle with value:
@(x,y,a)x.^2.*(x.^2-4.*a.^2)-y.^2.*(x.^2-a^2)
ezplot(@(x,y)f(x,y,3))
f = @(x,y,a) x .^ 2 .* y .^ 2 - a .^ 2 .* (y .^ 2 - x .^ 2)
f = function_handle with value:
@(x,y,a)x.^2.*y.^2-a.^2.*(y.^2-x.^2)
ezplot(@(x,y)f(x,y,3))
Cartesian Implicit Curves:
f = @(x,y,a) x .^ 3 + y .^ 3 - 3 .* a .* x .* y
f = function_handle with value:
@(x,y,a)x.^3+y.^3-3.*a.*x.*y
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 5 + y .^ 5 - 5 .* a .* x .^ 2 .* y .^ 2
f = function_handle with value:
@(x,y,a)x.^5+y.^5-5.*a.*x.^2.*y.^2
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 4 + y .^ 4 - 4 .* a .* x .* y .^ 2
f = function_handle with value:
@(x,y,a)x.^4+y.^4-4.*a.*x.*y.^2
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 4 + y .^ 4 - a .^ 2 .* (x .^ 2 - y .^ 2)
f = function_handle with value:
@(x,y,a)x.^4+y.^4-a.^2.*(x.^2-y.^2)
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 6 + y .^ 6 - a .^ 2 .* x .^ 2 .* y .^ 2
f = function_handle with value:
@(x,y,a)x.^6+y.^6-a.^2.*x.^2.*y.^2
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 4 + y .^ 4 + x .* y
f = function_handle with value:
@(x,y,a)x.^4+y.^4+x.*y
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 4 + y .^ 4 - 2 .* a .^ 2 .* x .* y
f = function_handle with value:
@(x,y,a)x.^4+y.^4-2.*a.^2.*x.*y
ezplot(@(x,y) f(x,y,4))
f = @(x,y,a) x .^ 5 + y .^ 5 - 5 .* a .^ 2 .* x .^ 2 .* y
f = function_handle with value:
@(x,y,a)x.^5+y.^5-5.*a.^2.*x.^2.*y
ezplot(@(x,y) f(x,y,4))
Parametric Curves: (Use fplot for parametric curves)
clear
x = @(a,theta) a .* cos(theta).^3
x = function_handle with value:
@(a,theta)a.*cos(theta).^3
y = @(b,theta) b .* sin(theta).^3
y = function_handle with value:
@(b,theta)b.*sin(theta).^3
fplot(@(theta) x(3,theta),@(theta) y(4,theta))
% To plot curve with different limits thn given default limit of -5 to 5, use following
fplot(@(theta) x(3,theta),@(theta) y(4,theta),[-1 1])
x = @(a,theta) a .* (theta + sin(theta))
x = function_handle with value:
@(a,theta)a.*(theta+sin(theta))
y = @(b,theta) b .* (1 + cos(theta))
y = function_handle with value:
@(b,theta)b.*(1+cos(theta))
fplot(@(theta) x(3,theta),@(theta) y(4,theta))
% To change color and marker style,
fplot(@(theta) x(3,theta),@(theta) y(4,theta),'r--')
% r represents red color and '--' represents marker style.
% For more styles, see documentation of plot using "doc plot" command
x = @(a,theta) a .* (theta - sin(theta))
x = function_handle with value:
@(a,theta)a.*(theta-sin(theta))
y = @(a,theta) a .* (1 - cos(theta))
y = function_handle with value:
@(a,theta)a.*(1-cos(theta))
fplot(@(theta) x(3,theta),@(theta) y(3,theta))
x = @(a,theta) a .* (theta - sin(theta))
x = function_handle with value:
@(a,theta)a.*(theta-sin(theta))
y = @(a,theta) a .* (1 + cos(theta))
y = function_handle with value:
@(a,theta)a.*(1+cos(theta))
fplot(@(theta) x(3,theta),@(theta) y(3,theta))
x = @(a,theta) a .* (theta + sin(theta))
x = function_handle with value:
@(a,theta)a.*(theta+sin(theta))
y = @(a,theta) a .* (1 - cos(theta))
y = function_handle with value:
@(a,theta)a.*(1-cos(theta))
fplot(@(theta) x(3,theta),@(theta) y(3,theta))
x = @(t) t .^ 2
x = function_handle with value:
@(t)t.^2
y = @(t) t - (t .^ 3 /3)
y = function_handle with value:
@(t)t-(t.^3/3)
fplot(@(t) x(t),@(t) y(t))
x = @(t,a) a .* t
x = function_handle with value:
@(t,a)a.*t
y = @(t,a) a ./ t .^ 2
y = function_handle with value:
@(t,a)a./t.^2
fplot(@(t) x(t,-3),@(t) y(t,-3))
x = @(a,theta) a .* (cos(theta) + 1/2 .*(log(tan(theta./2).^2)))
x = function_handle with value:
@(a,theta)a.*(cos(theta)+1/2.*(log(tan(theta./2).^2)))
y = @(a,theta) a.* sin(theta)
y = function_handle with value:
@(a,theta)a.*sin(theta)
fplot(@(theta) x(-6,theta),@(theta) y(-6,theta))