12.07.2015 Views

Matlab/Octave Tutorial

Matlab/Octave Tutorial

Matlab/Octave Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MATLAB 程 式 設 計 入 門 篇 : 初 探 MATLAB主 函 數 與 次 函 數 範 例• func5.m 包 含 一 個 主 函 數 及 一 個 次 函 數• 次 函 數 的 功 能 是 計 算 倒 數 向 量>> type func5.mfunction out = func5(x)recip = reciproc(x);out = sum(recip);% Definition for subfunctionsfunction output = reciproc(input)output = 1./input;• 呼 叫 此 函 數>> func5([1 2 3])ans =1.8333115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!