Home Whiteboard Online Compilers Practice Articles Tools
Library Courses Certifications Login
Matlab-Matrix Tutorial
  • Matlab-Matrix - Home
  • Matlab-Matrix - Introduction
  • Matlab-Matrix - Environment Setup
  • Matlab-Matrix - Create Matrix
  • Matlab-Matrix - Working with Matrices
  • Matlab-Matrix - Multiplication
  • Matlab-Matrix - Addition
  • Matlab-Matrix - Subtraction
  • Matlab-Matrix - Matrix Determinant
  • Matlab-Matrix - Inverse
  • Matlab-Matrix - Trace
  • Matlab-Matrix - Rank
  • Matlab-Matrix - Transpose
  • Matlab-Matrix - Deletion Row & Coloumn
  • Matlab-Matrix Useful Resources
  • Matlab Matrix - Quick Guide
  • Matlab Matrix - Useful Resources
  • Matlab Matrix - Discussion
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • AI Based Resume Builder
  • Personal AI Study Assistant
  • Generate Coding Logic
  • HR Interview Questions
  • Computer Glossary
  • Who is Who

Matlab-Matrix - Trace



Previous
Quiz
Next

Trace helps you to calculate the sum of diagonal elements in a given matrix.

Example

Consider the given 3x3 matrix. Let us find out the sum of diagonal elements as shown below −

a = [ 1 2 3; 2 3 4; 1 2 5];
test = trace(a)

Output

The execution in MATLAB is as follows −

>> a = [ 1 2 3; 2 3 4; 1 2 5]
test = trace(a)

a =

   1  2  3
   2  3  4
   1  2  5
 
test =

   9
   
>>
Print Page
Previous
Next
Advertisements
TOP TUTORIALS
  • Python Tutorial
  • Java Tutorial
  • C++ Tutorial
  • C Programming Tutorial
  • C# Tutorial
  • PHP Tutorial
  • R Tutorial
  • HTML Tutorial
  • CSS Tutorial
  • JavaScript Tutorial
  • SQL Tutorial
TRENDING TECHNOLOGIES
  • Cloud Computing Tutorial
  • Amazon Web Services Tutorial
  • Microsoft Azure Tutorial
  • Git Tutorial
  • Ethical Hacking Tutorial
  • Docker Tutorial
  • Kubernetes Tutorial
  • DSA Tutorial
  • Spring Boot Tutorial
  • SDLC Tutorial
  • Unix Tutorial
CERTIFICATIONS
  • Business Analytics Certification
  • Java & Spring Boot Advanced Certification
  • Data Science Advanced Certification
  • Cloud Computing And DevOps
  • Advanced Certification In Business Analytics
  • Artificial Intelligence And Machine Learning
  • DevOps Certification
  • Game Development Certification
  • Front-End Developer Certification
  • AWS Certification Training
  • Python Programming Certification
COMPILERS & EDITORS
  • Online Java Compiler
  • Online Python Compiler
  • Online Go Compiler
  • Online C Compiler
  • Online C++ Compiler
  • Online C# Compiler
  • Online PHP Compiler
  • Online MATLAB Compiler
  • Online Bash Terminal
  • Online SQL Compiler
  • Online Html Editor
  • ABOUT US
  • OUR TEAM
  • CAREERS
  • JOBS
  • CONTACT US
  • TERMS OF USE
  • PRIVACY POLICY
  • REFUND POLICY
  • COOKIES POLICY
  • FAQ'S
tutorials point logo
Download Android App Download IOS App

Tutorials Point is a leading Ed Tech company striving to provide the best learning material on technical and non-technical subjects.

© Copyright 2025. All Rights Reserved.