フィルターのクリア

Removing data that exceeds y limit in a plot

4 ビュー (過去 30 日間)
Hussein Kokash
Hussein Kokash 2021 年 7 月 13 日
コメント済み: Hussein Kokash 2021 年 7 月 13 日
Hello all,
I have this plot function which I use to plot data, I set the y axis range using ylim
figure(3)
hold on
plot(saved_x{i}, predicted_y{i})
ylim([-1e-5 1e-5])
hold off
The output looks like this:
I want to edit my script so that the plot eliminates the data that have y values out of this range [-1e-5 1e-5]
Meaning that only show the corresponding y values that are within the y range between -1e-5 and 1e-5.
Thank you so much!

回答 (1 件)

ANKUR KUMAR
ANKUR KUMAR 2021 年 7 月 13 日
x=linspace(0,3*pi,200);
y=cos(x);
plot(x,y)
You can set range while calling the plot function. This is just an example. I am setting the limit as [-0.5,0.5]. You can change that as per your need.
plot(x(y>-0.5 & y<0.5),y(y>-0.5 & y<0.5))
  1 件のコメント
Hussein Kokash
Hussein Kokash 2021 年 7 月 13 日
I tried it and it is giving me an odd shape just like your plot in the second image, I am trying to edit it and see how it becomes, I will let you know.
Thanks!

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

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by