How can I generate a continious signal? Generating a pulse?

1 回表示 (過去 30 日間)
Serhat
Serhat 2013 年 3 月 16 日
Hello,
My problem is to generate a pulse. While x-axis values are between 0 and 1, y-axis is equal to 1 except that x-axis are between 0.5 and 0.75, y is equal to -1.
How can I create a unit step like this?
Thanks

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 16 日
編集済み: Azzi Abdelmalek 2013 年 3 月 16 日
t=0:0.001:1
y=ones(1,numel(t))
y(t>0.5 & t<0.75)=-1
plot(t,y,'r','linewidth',3)
  2 件のコメント
Serhat
Serhat 2013 年 3 月 16 日
Ooo, thank you so much. What is "numel" doing there exactly?
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 16 日
x=[2 4 6 8]
n=numel(x) % number of elements in x

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by