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 User defined Function Example

Introduction

In this tutorial, we will learn about user-defined functions in Octave. User-defined functions are stored in a separate file with the filename as the function name.

User-defined function

Let’s write a sample function to convert Fahrenheit temperature to Celsius temperature.

We will use the following conversion formula:

 

\huge C = 5*(F - 32)/9

 

 function [Celsius] = FahToCel(Fahrenheit)
% Function: FahToCel.m
% 
Celsius = 5*(Fahrenheit-32)/9;
endfunction

user defined octave

Function Call

We can invoke the function with the function name and pass the parameters.

%Sample Usage
% How to invoke the user defined function
celsius = FahToCel(50);
disp(celsius);

 

—

Octave Tutorials

Octave Tutorial on this website can be found at:
https://www.testingdocs.com/octave-tutorial/

More information on Octave can be found on the official website:
https://www.gnu.org/software/octave/index

 

Related Posts

Octave Package List

Octave /

Install Octave Packages on Linux

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 Install Ubuntu Linux

Octave /

Install Octave on Ubuntu Linux

‹ Octave Command line on Ubuntu› Install Octave Packages on Linux

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle
  • Draw Parallel Lines using Flowgorithm Graphics

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version