Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ツールボックスを使用してmatlabで関数を計算する方法はありますか? たとえば、次の関数があります: f(x,y)=x^2+y^2、x=2 と y=2 を設定し、関数が 8 を取り戻すようにするにはどうすればよいですか? ありがとう
たとえば、次のような無名関数を使用できます。
f=@(x,y)x.^2+y.^2;
または、たとえばabc.m次のコードを含むファイルを作成します。
abc.m
function f=abc(x,y) f= x.^2+y.^2;
関数ファイルがパスにある場合、 abc(2,2) は答えを返します。