フィルターのクリア

Adjusting data points that fit a criteria

1 回表示 (過去 30 日間)
Matt
Matt 2012 年 12 月 6 日
Basically for some points say
x = 1:1:100; y = x;
plot(x,y);
how can i for example add 1 for x values between 10 and 20.
i tried
if x >10 & x <20;
x1 = x+1;
end
plot(x1,y)
but it doesnt seem to make a variable, but i dont get an error either

採用された回答

Wayne King
Wayne King 2012 年 12 月 6 日
編集済み: Wayne King 2012 年 12 月 6 日
x = 1:1:100; y = x;
x(x>10 & x<20) = x(x>10 & x<20)+1;
plot(x,y)
If you want a new variable
x1 = x;
x1(x1>10 & x1<20) = x1(x1>10 & x1<20)+1;
plot(x1,y)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCurve Fitting Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by