• TestingDocs
TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Octave

Octave Subtraction Operator

Overview

In this tutorial, we will learn about Octave Subtraction Operator with Examples.

Octave Subtraction Operator

The subtraction operator in Octave is minus (-). The – operator is a binary operator. It requires two operands for mathematical computation. The operands can be scalars or matrices.

Examples

Subtracting scalar operands

If the operands are scalars the subtraction operator subtracts the operands. Here in this example, x and y are scalar operands. We use the – operator to subtract and store the result in a variable called result.

>> x = 9;
>> y = 7;
>> result = x – y;
>> result

result = 2

Octave Subtraction Operator

Subtracting matrices

If the operands are matrices, the number of rows and columns of the operands must agree or must be broadcastable.

We can use the  .-  operator for the element-wise subtraction of the matrices.

>> x = [ 5 6 ; 7 8];

>> y = [ 2 4 ; 5 6];

>> result = x .- y ;

>> result

result =

3        2

2         2

GNU Octave Subtraction Operator

—

Octave Tutorials

GNU Octave Tutorials on this website can be found at:

https://www.testingdocs.com/octave-tutorial/

For more information on Octave, visit the official website:

https://www.gnu.org/software/octave/index

Related Posts

Octave Package List

Octave /

Install Octave Packages on Linux

Octave /

Octave User defined Function Example

octave command line linux

Octave /

Octave Command line on Ubuntu

Hello World in Octave

Octave /

Hello World in Octave

Octave /

Octave plot example of function y=x^2

‹ Octave Addition Operator› Octave Multiplication Operator

Recent Posts

  • How to secure your SQL Database: Tips and Tricks
  • Shaping the Future of Development: Exploring Key Trends in Software Engineering
  • Improving Java Performance with Multithreading
  • Difference between PHP and JavaScript?
  • Bing Conversation Styles
  • ChatGPT Introduction
  • Open Source AI Frameworks
  • Artificial Intelligence Tools
  • Top AI Music Applications
  • Top AI Website Design Tools

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com