フィルターのクリア

How to discretize non-uniformally a curve

1 回表示 (過去 30 日間)
Christos Patrinos
Christos Patrinos 2021 年 9 月 6 日
コメント済み: Star Strider 2021 年 9 月 6 日
Hello,
Let's assume I have the following curves (see smooth solid lines) and I want to discretize them. I know about the discretize function, but what I would want is to discretize them using variable steps (see lines in discretized pattern). I know the easiest way is to manually discretize them by putting all the points hard coded and generating the pattern, but my main question is if there is an automated way through which I could input the reference curve, the number of points and their respective durations and have the curves created automatically.
Many thanks.

採用された回答

Star Strider
Star Strider 2021 年 9 月 6 日
One option is the stairs function —
x = linspace(0, 400,50);
y = [exp(x/100); sin(x/100)-x/400];
figure
plot(x, y)
grid
figure
stairs(x, y(1,:))
[xb{1}, yb{1}] = stairs(x, y(1,:));
hold on
stairs(x, y(2,:))
[xb{2}, yb{2}] = stairs(x, y(2,:));
hold off
grid
GetData= [xb{1}(1:10) yb{1}(1:10)]
GetData = 10×2
0 1.0000 8.1633 1.0000 8.1633 1.0851 16.3265 1.0851 16.3265 1.1773 24.4898 1.1773 24.4898 1.2775 32.6531 1.2775 32.6531 1.3862 40.8163 1.3862
Experiment to get different results.
.
  2 件のコメント
Christos Patrinos
Christos Patrinos 2021 年 9 月 6 日
Thank you for your answer @Star Strider; I think it is a good starting point!
Star Strider
Star Strider 2021 年 9 月 6 日
As always, my pleasure!
.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by