matlabにおける@の意味はなんでしょうか?
이전 댓글 표시
reductionFcn = @(x)x;
上記の構文が例題にあったのですが、右辺の意味がわかりません。
matlabにおける@の意味は何でしょうか?
채택된 답변
추가 답변 (1개)
■reductionFcn = @(x) x;について
無名関数、通称ラムダ(LAMBDA)関数における変数の宣言です。
意味としましては、reductionFcn = @(使う変数) 関数 になります。
■何がうれしいか
よく使用される数式の関数を作成し、使いまわせることが利点です。
f = @(x,y) x + y
f(1,2)
f((1:3),5)
■その他
Fs = 100;
t = (0:1/Fs:3);
T = table2cell(table((1:3)')) % 1~3の変数をcell型にしています
スイープパラメータの設定
C = cellfun(@(x) MyFcn(t,x),T,UniformOutput=false); % cell型のxのみ使用する
まとめて図示
figure
hold on
cellfun(@(x) plot(t,x),C,UniformOutput=false)
自作関数
function y = MyFcn(t,x)
tmp = x.^2;
y = tmp.*sin(2*pi.*x.*t);
end
카테고리
도움말 센터 및 File Exchange에서 コマンドの入力에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
