フィルターのクリア

How to define function

2 ビュー (過去 30 日間)
Viktoriia Buliuk
Viktoriia Buliuk 2020 年 8 月 11 日
コメント済み: Viktoriia Buliuk 2020 年 9 月 4 日
Hello!
Could you, please, suggest an answer:
How to define function f (x), which for x from -1 to 1, f (x) = 1; and outside these limits f (x) = 0.
Thank in advance!
  3 件のコメント
Viktoriia Buliuk
Viktoriia Buliuk 2020 年 8 月 11 日
I try to define Window function. I have tried with if.
KSSV
KSSV 2020 年 8 月 11 日
Show us your code.

サインインしてコメントする。

採用された回答

hosein Javan
hosein Javan 2020 年 8 月 11 日
function y = f(x)
y = zeros(size(x));
y(abs(x) < 1) = 1;
end
  5 件のコメント
hosein Javan
hosein Javan 2020 年 8 月 11 日
ofcourse unless you want to use function file, you need this multiplication only to define your function in anonymous form. correct.
Viktoriia Buliuk
Viktoriia Buliuk 2020 年 9 月 4 日
Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by