Filtering out y values

6 ビュー (過去 30 日間)
Fabian
Fabian 2023 年 6 月 19 日
コメント済み: Fabian 2023 年 6 月 20 日
Hello all, I'm having some trouble with filtering out some data from the graph attached. Basically, I want to have the graph where it is just the wave through the range of 8-13. Anything below 8 and over 13 I want hidden in the graph. Thank you.

採用された回答

VBBV
VBBV 2023 年 6 月 19 日
編集済み: VBBV 2023 年 6 月 19 日
Here's what you can do to filter y values from a dataset , by applying a condition
x = 0:8e4;
y = 20*rand(length(x),1);
scatter(x(1:1e3:end),y(1:1e3:end),'ko')
idx = y > 8 & y < 13;
y = y(idx);
x = x(idx);
scatter(x(1:1e3:end),y(1:1e3:end),'ko')
ylim([0 20])
  1 件のコメント
Fabian
Fabian 2023 年 6 月 20 日
Thank you so much this helped me solve my problem.

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

その他の回答 (1 件)

Daniel
Daniel 2023 年 6 月 20 日
If you're just looking for visual zoom, you can use the ylim command to set the y-limits on a graph. xlim works similarly for x-limits.
t = 0:0.01:10;
x = sin(2*pi*t) + randn(size(t)).^2+randn(size(t)).^2;
plot(t,x,'o')
title('Without ylim')
figure
plot(t,x,'o')
ylim([-1.5 5])
title('With ylim')

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by