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 程 式 設 計 入 門 篇 : 初 探 MATLABM 檔 案 的 顯 示• 在 目 前 目 錄 下 有 一 個 M 檔 案 “script01.m”, 可 用type 指 令 顯 示 其 內 容 :>> cd ’d:\ matlabBook\MATLAB 程 式 設 計 : 入 門 篇 \15-M 檔 案 ’>> type script01.mclear all% 清 除 所 有 變 數x = [1 4 -2 3 -1 -5];for i = 1:length(x),if x(i)>0,fprintf('x(%g) = %g is positive\n', i, x(i));elsefprintf('x(%g) = %g is negative or zero\n', i, x(i));endend91

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

Saved successfully!

Ooh no, something went wrong!