EDUCBA

EDUCBA

MENUMENU
  • Explore
    • Lifetime Membership
    • All in One Bundles
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Login
Home Data Science Data Science Tutorials Matlab Tutorial Laplace Transform MATLAB

Laplace Transform MATLAB

Priya Pedamkar
Article byPriya Pedamkar

Updated June 6, 2023

Laplace Transform MATLAB

Introduction to Laplace Transform MATLAB

MATLAB is a programming environment that is interactive and is used in scientific computing. It is extensively used in many technical fields where problem-solving, data analysis, algorithm development, and experimentation are required. The discipline-specific software is extensively written using MATLAB.

ADVERTISEMENT
Popular Course in this category
MATLAB Course Bundle - 5 Courses in 1 | 3 Mock Tests

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

This article will study the MATLAB function used to calculate the Laplace transform. Before we get into details of how the Laplace function works in MATLAB, let us refresh our understanding of the Laplace transform.

Laplace transformation is used to solve differential equations. In Laplace transformation, the time domain differential equation is first converted into an algebraic equation in the frequency domain. Next, we solve this algebraic equation and transform the result into the time domain. This will be our solution to the differential equation. In simpler words, Laplace transformation is a quick method to solve differential equations.

Syntax

Let us understand the syntax of the Laplace function in MATLAB

Laplace (f)

Description of Laplace function in MATLAB:

  • laplace (f) returns the Laplace transform of the input ‘f’.

Examples to Implement Laplace Transform MATLAB

Let us now understand Laplace function with the help of a few examples

Example #1

In the first example, we will compute laplace transform of a sine function using laplace (f): Let us take asine signal defined as:

  • 4 * sin (5 * t)

Mathematically, the output of this signal using laplace transform will be:

  • 20/ (s^2 + 25), considering that transform is taken with ‘s’ as the transformation variable and ‘t’ as the independent variable.

Syntax

syms t[Initializing the variable] f = 4*sin(5*t);[Input sine function] Lt = laplace(f)[Using the laplace function to get the laplace transform]

Code:

syms t
f = 4*sin (5*t);
Lt = laplace (f)

Output:

As we can see, the transform is in terms of the variable ‘s,’ and the output is as expected by us.

Laplace Transform MATLAB - 1

Example #2

Here is an example where we compute laplace transform of a cosine signal using laplace (f):

Lets us take cosine signal defined as:

  • cos (t) + cos (3 *t) ;

Mathematically, our output should be:

  • s / (s ^ 2 + 1) + s / (s ^ 2 + 9)

Syntax

syms t[Initializing the variable] f = cos (t) + cos (3 *t) ;[Input cos function] Lt = laplace(f)[Using the laplace function to get the laplace transform]

Code:

syms t
f = cos (t) + cos (3 * t) ;
Lt = laplace (f)

Output:

As we can see, the Laplace transform is calculated w.r.t ‘s,’ and the output is as expected by us.

matrix

Example #3

In the next example, we will compute Laplace transform of an exponential function using laplace (f):

Lets us take an exponential function defined as:

  • exp (-2*a^2);

Mathematically, our output should be:

  • (2^ (1/2) *pi^ (1/2) *exp (s^2/8) *erfc( (2^ (1/2) *s) /4) ) /4

Syntax

syms a[Initializing the variable] f = exp (-2 *a^2) ;[Input exponential function] Lt  = laplace(f)[Using the laplace function to get the laplace transform]

Code:

syms a
f = exp (-2 *a^2);
Lt  = laplace (f)

Output:

As we can see, the laplace transform is calculated w.r.t ‘s’, and the output is as expected by us.

Laplace Transform MATLAB - 3

Example #4

Next, we will learn to calculate Laplace transform of a matrix. In the case of a matrix, the function will calculate laplace transform of individual elements of the matrix.

Below is the example where we calculate the Laplace transform of a 2 X 2 matrix using laplace (f): Let us define our matrix as:

  • Z = [exp (2x) 1; sin (y) cos (z) ];

Now for each element in the matrix, we must pass transformation & independent variables.

  • Let us define our independent variables as:Variables = [w a; b c];
  • And Transform variables as:Transfrom_Variables = [p q; r s];

Mathematically, our output should be:

  • [ exp (2x) /p,     1/q] [ sin (y) /r, cos (z) /s]

Syntax

syms a b c w p q r s[Initializing the variables] Z = [exp (2x)     1;   sin (y)    cos (z)];[Input matrix with different signals] Variables = [w a; b c];[Independent variables] Transfrom_Variables = [p q; r s];[Transformation variables] laplace(Z,Variables,Transfrom_Variables)

Code:

syms a b c d w x y z
Z = [exp (2*x) 1; sin (y) cos (z)];
Variables = [w a; b c];
Transfrom_Variables = [p q; r s];
laplace (Z, Variables, Transfrom_Variables)

Output:

As we can see, we have got the laplace transform of every element in the matrix Z.

matrix Z.

Conclusion

In MATLAB, you can use the Laplace function to calculate the Laplace transform of a function. We can calculate the Laplace transform w.r.t to the default transformation variable‘s’or the variable we define as the transformation variable.

Recommended Articles

This is a guide to Laplace Transform MATLAB. Here we discuss an introduction to Laplace Transform MATLAB, syntax, and examples for better understanding. You can also go through our other related articles to learn more –

  1. Bessel Functions In MATLAB
  2. Mean Function In Matlab
  3. Filter Function In Matlab
  4. Piecewise Function In Matlab
ADVERTISEMENT
SPSS Course Bundle - 14 Courses in 1 | 5 Mock Tests
34+ Hours of HD Videos
14 Courses
5 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
MICROSOFT AZURE Course Bundle - 15 Courses in 1 | 12 Mock Tests
63+ Hour of HD Videos
15 Courses
12 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
HADOOP Course Bundle - 32 Courses in 1 | 4 Mock Tests
125+ Hour of HD Videos
32 Courses
4 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
INFORMATICA Course Bundle - 7 Courses in 1
47+ Hours of HD Videos
7 Courses
Verifiable Certificate of Completion
Lifetime Access
4.5
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

🚀 Extended Cyber Monday Price Drop! All in One Universal Bundle (3700+ Courses) @ 🎁 90% OFF - Ends in ENROLL NOW