How do i detect/describe a curvature from a data-set of coordinates

8 ビュー (過去 30 日間)
Conrade Muyambo
Conrade Muyambo 2019 年 5 月 23 日
編集済み: Conrade Muyambo 2019 年 5 月 24 日
I have a data-set of coordinates that makes up a 2d body. It's a rectangular shape with one side curved or kinda circular. I would like to describe this curved side with a polyfit line so that I can be able to get the radius. How can I achieve this? Thank you for your very much!
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 5 月 23 日
編集済み: KALYAN ACHARJYA 2019 年 5 月 23 日
Mathematical language is far better communication way to clear your doubt.

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

採用された回答

Star Strider
Star Strider 2019 年 5 月 23 日
The polyfit function will not give you the centre and radius of your arc.
This will:
t = linspace(-pi/4, pi/4, 10); % Create Data
r = 2.5; % Create Data
x = r*cos(t)+1; % Create Data
y = r*sin(t)+2; % Create Data
fcn = @(b) norm(((x(:)-b(1)).^2 + (y(:)-b(2)).^2) - b(3).^2); % Objective Function
B = fminsearch(fcn, rand(3,1)); % Estimate Parameters
Cx = B(1) % Center X-Coordinate
Cy = B(2) % Center Y-Coordinate
R = B(3) % Radius
% B = fsolve(fcn, rand(3,1))
figure
plot(x, y, 'pg')
hold on
plot(Cx, Cy, 'pb')
plot([Cx x(1)], [Cy y(1)], '-r')
hold off
grid
legend('Data', 'Centre', 'Radius')
axis equal
How do i detect-describe a curvature from a data-set of coordinates - 2019 05 23.png
Experiment with it to get the result you want.
  10 件のコメント
Conrade Muyambo
Conrade Muyambo 2019 年 5 月 24 日
編集済み: Conrade Muyambo 2019 年 5 月 24 日
Thank you. That helped a lot. But is it now possible, with the start point of one arc and the end point of the second arc to fit a curve to describe the side?
Star Strider
Star Strider 2019 年 5 月 24 日
As always, my pleasure.
No.
The arc parameters describe the arcs only.
I have no idea how to describe the sides, since that is not what you requested initially.
See my oiriginal Answer (the ‘Create Data’ assignments) to understand how to describe the arcs.

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

その他の回答 (2 件)

Conrade Muyambo
Conrade Muyambo 2019 年 5 月 24 日
It served the purpose sir! That was only a question. Thank you
  1 件のコメント
Star Strider
Star Strider 2019 年 5 月 24 日
As always, my pleasure!
You can likely adapt my code to estimate the sides that are not part of the arcs, although since they are more linear that nonlinear, a linear or ‘slightly nonlinear’ regression could work.

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


Conrade Muyambo
Conrade Muyambo 2019 年 5 月 24 日
編集済み: Conrade Muyambo 2019 年 5 月 24 日
Okay I understand, i will work on it. I will post a different topic later, but not related to this regarding the same shape,.

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by