我與Octave4.2.1工作,我寫了這個功能(文件OctaveFunction.m
中):我在八度音功能不起作用
function y = squareNumber(x)
y = x^2;
endfunction
但如果我調用函數,我得到這個錯誤:
error: 'squareNumber' undefined near line 1 column 1
,如果我嘗試調用這樣的功能:
OctaveFunction squareNumber(4)
我得到另一個錯誤:
warning: function name 'squareNumber' does not agree with function filename 'C:\Users\HOME\Desktop\OctaveFunction.m' error: for x^A, A must be a square matrix. Use .^ for elementwise power. error: called from OctaveFunction at line 2 column 7
我哪裏出錯了?謝謝!
嘗試'y = x。^ 2;'由於錯誤提示 –