フィルターのクリア

How do i create a matrix of size 1 row and 1501 column, with values [1 -1 1 -1 1 -1.... etc

3 ビュー (過去 30 日間)
ken thompson
ken thompson 2012 年 5 月 1 日
(countinuously 1 then -1 repeating.
thanks Dan

回答 (3 件)

Bjorn Gustavsson
Bjorn Gustavsson 2012 年 5 月 1 日
v = (-1).^(0:n);
HTH

Wayne King
Wayne King 2012 年 5 月 1 日
One way:
x = ones(1,1501);
x(2:2:end) = -1*x(2:2:end);
Another way
y = repmat([1 -1],1,751);
y(end) = [];

Daniel Shub
Daniel Shub 2012 年 5 月 1 日
[repmat([1,-1], 1, floor(1501/2)), 1]

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by