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
  • Log in
  • Sign up
Home Data Science Data Science Tutorials Matlab Tutorial Summation in Matlab

Summation in Matlab

Priya Pedamkar
Article byPriya Pedamkar

Updated March 27, 2023

Summation in Matlab

Introduction to Summation Function in Matlab

MATLAB provides its users with a variety of functions with great utilities. This article is focussed on understanding a powerful function called ‘Summation function’. In this topic, we are going to learn about Summation in 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

Mathematical formulae often require the addition of a number of variables. Summation, also called sigma is a simple and convenient notation used to represent an expression for sum of the values of the given variable.

Let a1, a2, a3, …an are denoting a set of n random numbers.  a1 is the 1st number of the set. ‘ai’ represents the ‘ith’ number of this set.

Summation Notation

The notation consists of:

1. The summation/sigma sign: This is defined by the symbol S. The symbol of summation is a Greek letter, S, in the upper case. This summation sign signifies that we need to add the elements of the sequence. The element of the given sequence which we are summing appears at the right side of this summation sign.

2. The variables of summation or the variables which are being added: The variables of summation are represented using an index. This index is placed beneath our summation sign. Often, the index is represented by i. (Other commonly used representations of the index are j & t). This index is represented by an expression i = 1. This index takes values that start with the value that is on the RHS of the equation and ends with the value that is above the sign of summation.

3. The starting point of the summation also called the lower limit for the summation

4. The stopping point of the summation also called the upper limit for the summation

Now that we have understood summation function, let’s see how it works in MATLAB

Syntax of Summation Function:

S = symsum(s, i, a, b)

Now let us understand the syntax with the help of various examples

Description of SymSum in Matlab

1. S = symsum(s, i, a, b)

  • Here s is a series, i is summation index and a and b are lower and upper bound values, the function S will result in sum of s series for index i from lower and upper bound values.
  • The syntax can be alternatively written as symsum(s, i, [a b]) or symsum(s, i, [a;b])

Here is a simple example where we calculate the sum of a series using summation function:

Example

S = symsum(s, s, 0, 10)

Here s is a series which starts at 0 and end at 10

X=10

S=∑s

x=0

the function will return:

S = 55 (which is the sum of 0 + 1 + 2 + 3 +………+ 10)

This is how are input and output will look like in MATLAB console:

Summation in Matlab input 1

 Code:

syms s
S = symsum(s, s, 0, 10)

Summation in Matlab output 1

Let’s take a more complex example:

Code:

S = symsum(s^2 , s, 0, 10)

Here s is a series which starts at 0 and end at 10 and is raised to the power 2 in the function.

The function will return:

S= 385 ((0 x 0) + (1 X 1) + (2 x 2) + (3 x 3)  + …… + (10 x 10))

This is how are input and output will look like in MATLAB console:

Summation in Matlab input 2

Code:

syms s
S = symsum(s^2 , s, 0, 10)

Summation in Matlab output 2

We can also have sum till infinity, as explained in the below example:

Code:

S = symsum(s, s, 0, inf)

Here s is a series that starts with 0 and ends at infinity.

The function will return infinity as the sum

S= ∞

This is how are input and output will look like in MATLAB console:

input 3

S = symsum(s, s, 0, inf)

output 3

Here is an alternative syntax for Summation:

Syntax:

S = symsum(s, s, [0, 10])

the function will return:

S = 55

Let’s now understand how to find the summation of a given polynomial series:

 K=5

F(x) = ∑ x^k , let this be our polynomial.

K=1

To calculate the sum of this polynomial, let us assume the value of x as 2

Code:

syms x k
F(x) = symsum (x^k, k, 1, 5)

This is how the output function will look like in MATLAB:

output 4

Let us now put the value of x as 2

Below is how our input and output will look like in MATLAB:

syms x k
F(2) = symsum (2^k, k, 1, 5)

output 5

So, the summation function in MATLAB can be used to find sum of a series. This series can be a simple series of numbers or a polynomial function.

Recommended Articles

This is a guide to Summation in Matlab. Here we discuss the Description of SymSum in Matlab along with the examples. You may also have a look at the following articles to learn more –

  1. Colormap in Matlab
  2. Identity Matrix in Matlab
  3. Matlab Plot Marker
  4. Log Plot Matlab
  5. Guide to Linear Fit 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
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
  • Blog as Guest
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

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?

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

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