Suppose, v(x) is a user-defined function. How, to get v(-x) which is going to be used in the same code?
古いコメントを表示
Is there any in-built MATLAB function to do it. Should we define user-defined function, say, a local function. If so, how that can be done?
回答 (2 件)
Titus Edelhofer
2015 年 2 月 13 日
Hi,
sorry, I don't understand the question. If you have the function, why don't you simply call v(-x)?
Or are you looking for defining this function? In this case you could do e.g.
minusv = @(x) v(-x);
Titus
1 件のコメント
SAMIT KUMAR GUPTA
2015 年 2 月 15 日
Once you define a function v, you can call it with either v(x) or v(-x) or any other suitable values that you want to use. Calling a function is independent of how it is defined:
>> A = @(x)disp(x); % define a function A
>> A(3)
3
>> A(-3)
-3
1 件のコメント
SAMIT KUMAR GUPTA
2015 年 2 月 15 日
カテゴリ
ヘルプ センター および File Exchange で Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!