こんにちは、Matlab で次の動作を実現する方法について質問があります。
A.x=pi
A.sin=@()sin(A.x)
A.sin() % Returns 1.2246e-16, essentially 0 so all good so far.
% Now for the problem
A.x = pi/2
A.sin() % Returns 1.2246e-16, meaning the new A.x is not used. It should return 1.
これを達成する方法は誰にもありますか?A.sin を定義して@(x) sin(x)
Ax を提供できることはわかっていますが、代わりの方法を見つけたいと考えています。
ありがとう。