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 程 式 設 計 入 門 篇 : 初 探 MATLABSort 指 令• sort 指 令 可 對 向 量 元 素 進 行 排 序 (Sorting)• 範 例 9-20: sort01.mx = [3 5 8 1 4];[sorted, index] = sort(x)sorted =1 3 4 5 8index =4 1 5 2 3% 對 矩 陣 x 的 元 素 進 行 排 序• sorted 是 排 序 後 的 向 量 ,index 則 是 每 個 排 序 後 的 元 素 在 原向 量 x 的 位 置• x(index) 即 等 於 sorted 向 量• 如 何 使 用 sort 指 令 加 上 前 例 中 的 sorted 及 index 來 求 得 原先 的 向 量 x?84

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

Saved successfully!

Ooh no, something went wrong!