フィルターのクリア

How do we allocate equidistant points on a sinusoidal curve?

7 ビュー (過去 30 日間)
Satyajit Ghosh
Satyajit Ghosh 2021 年 10 月 19 日
コメント済み: Satyajit Ghosh 2021 年 10 月 20 日
The analytic equation is given below.
y=-25*sin((2*pi/50)*x);
Graph of above equation is given below.
What I exactly want is to allocate discrete equidistant points on this sinusoid curve. The step distance is 0.004. Basically, I have to solve the below equation starting from initial (x,y)=(0,0) point and use next point to calculate further point one by one.
(x-x_p).^2+(y-y_p).^2=(0.004)^2
=> (x-x_p).^2+(-25*sin(2*pi/50)*x)+25*sin(2*pi/50)*x_p)).^2=(0.004)^2
Here (x_p,y_p) is the previous point. But above equation is a trancendental equation. I am unable to solve it.
Thanks in advance!

採用された回答

Matt J
Matt J 2021 年 10 月 19 日
編集済み: Matt J 2021 年 10 月 19 日
You can use fzero,
x_p=0;
y=@(x) -25*sin((2*pi/50)*x);
fun=@(d) d.^4+( y(x_p+d^2)-y(x_p)).^2 - 0.004^2;
x=x_p+fzero(fun,0).^2
x = 0.0012
Check:
norm([x-x_p, y(x)-y(x_p)])
ans = 0.0040

その他の回答 (1 件)

Matt J
Matt J 2021 年 10 月 19 日

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by