how to define the following function
古いコメントを表示
How to define the following function in MATLAB
f(x) = 1 for 0<= x <= pi
f(x) = 1 for 0<= x <= pi
1 件のコメント
Walter Roberson
2013 年 1 月 21 日
You seem to have the same entry twice ?
回答 (1 件)
Thorsten
2013 年 1 月 21 日
if 0 <= x && x <= pi, y = 0; end
1 件のコメント
Walter Roberson
2013 年 1 月 21 日
Or, vectorized:
y = zeros(size(x));
y(x >= 0 & x <= pi) = 1;
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!