Skip to content
Related Articles

Related Articles

Improve Article

Limit of symbolic expression in MATLAB

  • Last Updated : 28 Jun, 2021
Geek Week

Limits are functions used in calculus, appearing in the definitions of continuity, derivatives, and integrals. The limit of a symbolic expression is defined as the behavior of the symbolic expression at a particular point.

Suppose \lim_{x \to \infty}(1/x) = 0. \,    As x approaches to infinity (1/x) becomes 0.

Matlab allows users to calculate the limit of a symbolic expression using limit() method. Different syntax of limit() method

  • limit(f,var,a)
  • limit(f,a)
  • limit(f)
  • limit(f,var,a,’left’)
  • limit(f,var,a,’right’)

limit(f,var,a)

  • It returns the limit of function f when var approaches to a.
  • {L=\displaystyle \lim _{var\to a}f(var)}

Example:

Matlab






% MATLAB code for define a %
% symbolic expression f in variable x %
syms x
f = cos(x)/x;
disp('f(x) :');
disp(f);
 
% Limit of f when x approaches to Inf
l = limit(f,x,Inf);
disp("Limit (x->Inf): ");
disp(l);

 

 

Output :

 

limit(f,a)

 

It returns the limit of function f when the default variable approaches to a.

 



Example:

 

Matlab




% MATLAB code for define a %
% symbolic expression f in variable x %
syms x
f = x^x;
disp('f(x) :');
disp(f);
 
% Limit of f when default variable(x) %
% approaches to 0 %
l = limit(f,0);
disp("Limit (x->0): ");
disp(l);

 

 

Output:

 

limit(f)

 

It returns the limit of function f when the default variable approaches 0.



 

Example:

 

Matlab




% MATLAB code for define a %
% symbolic expression f in variable x %
syms x
f = tan(x)/x;
disp('f(x) :');
disp(f);
 
% Limit of f when x approaches to 0 %
l = limit(f);
disp("Limit (x->0): ");
disp(l);

 

 

Output :

 

limit(f,var,a,’left’)

  • It returns the left limit of function f when the var approaches a.
  • L =  \lim_{var \to a^-}f(var)

 



Example:

 

Matlab




% MATLAB code for define a %
% symbolic expression f in variable x %
syms x
f = 1/(2*x);
disp('f(x) :');
disp(f);
 
% Left limit of f when x approaches to 0
l = limit(f,x,0,'left');
disp("Left limit: ");
disp(l);

 

 

Output :

 

limit(f,var,a,’right’)

  • It returns the right limit of function f when the var approaches a
  • L =  \lim_{var \to a^+}f(var)

 

Example:



 

Matlab




% Define a symbolic expression f in variable x
syms x
f = 1/(2*x);
disp('f(x) :');
disp(f);
 
% Right limit of f when x approaches to 0
l = limit(f,x,0,'right');
disp("Right limit: ");
disp(l);

 

 

Output :

 

 




My Personal Notes arrow_drop_up
Recommended Articles
Page :