Effacer les filtres
Effacer les filtres

曲率を求める関数はありますか?

34 vues (au cours des 30 derniers jours)
Yumi Iwakami
Yumi Iwakami le 24 Oct 2019
Commenté : Smith David le 15 Jan 2024
経時的に重心位置が変わる画像の重心の座標値を取得し,プロットした点群を線で結び,その曲線の曲率を求めたいのですが,曲率を求める関数はあるのでしょうか?
  1 commentaire
Smith David
Smith David le 15 Jan 2024
MATLABを使用して曲率を求めるには、いくつかの方法があります。以下は、MATLABのCurve Fitting Toolboxを使用して曲率を計算する例です。
matlabCopy code
% 例として、xとyは時間に対する画像の重心の座標値のデータと仮定します % これらのデータは実際のデータに置き換える必要があります % データの生成(仮のデータ) t = linspace(0, 1, 100); x = sin(2 * pi * t); y = cos(2 * pi * t); % 画像の重心の座標値をプロット plot(x, y, 'o'); % フィッティングオプションを設定 fitType = fittype('a*x^2 + b*x + c'); fitOptions = fitoptions('Method', 'NonlinearLeastSquares', 'StartPoint', [1, 1, 1]); % データに曲線をフィット fitResult = fit(t', x', fitType, fitOptions); % フィットした曲線をプロット hold on; plot(fitResult); % 曲率を計算 curvature = computeCurvature(fitResult, t); % 結果を表示 disp('曲率:'); disp(curvature); function curvature = computeCurvature(fitResult, t) % 曲率を計算する関数 % 曲線の座標を微分 dx = gradient(feval(fitResult, t), t); dy = gradient(feval(fitResult, t, 'y'), t); % 2階微分 d2x = gradient(dx, t); d2y = gradient(dy, t); % 曲率の計算 漫画raw curvature = abs((dx .* d2y - dy .* d2x) ./ ((dx.^2 + dy.^2).^(3/2))); end
この例では、与えられたデータに対して二次曲線をフィットし、その曲率を計算しています。データは実際のものに置き換え、必要に応じてフィッティング関数を変更してください。

Connectez-vous pour commenter.

Réponses (1)

michio
michio le 24 Oct 2019
  1 commentaire
Yumi Iwakami
Yumi Iwakami le 24 Oct 2019
ありがとうございます.
私が試しているのは2次元のピクセル座標系なので,精読してみないとわかりませんが試してみようと思います.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 内挿 dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!