Calculate a curve out of points and the curvature radius

조회 수: 12 (최근 30일)
Jon Bilbao
Jon Bilbao 2023년 4월 13일
답변: Jon Bilbao 2023년 4월 13일
I have a curve with a variable curvature radius and i want to calculate a function tha defines that radius.
x and y are the coordinates of some points in the x an y axis, and with that ponts i want to calculate a curve fitting them with splines and the calculate de curvature radius of that curve.
I dont know why theres is an error in this function.
Does anyone know how to solve it?
Thanks
function [r] = rtrans2(x,y)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
s=csapi(x,y);
r=((diff(s,2)).^2)/(1+diff(s,1).^2);
end
  댓글 수: 9
Jon Bilbao
Jon Bilbao 2023년 4월 13일
편집: Jon Bilbao 2023년 4월 13일
The problem is solved thanks , with fnder the function worked, the function is the next:
function [r] = rtdef(x,y,Lc)
xi = 0:0.1:Lc;
pp = csapi(x, y);
yi = ppval(pp, xi);
yp = fnval(fnder(pp), xi);
ypp = fnval(fnder(pp,2), xi);
r = ((1 + yp.^2).^(3/2)) ./ abs(ypp);
end
Sam Chak
Sam Chak 2023년 4월 13일
@Jon Bilbao, good to see that you've found the solution. I'd advise you to move your solution in the comment to the Answer section.

댓글을 달려면 로그인하십시오.

채택된 답변

Jon Bilbao
Jon Bilbao 2023년 4월 13일
Solved:
function [r] = rtdef(x,y,Lc)
xi = 0:0.1:Lc;
pp = csapi(x, y);
yi = ppval(pp, xi);
yp = fnval(fnder(pp), xi);
ypp = fnval(fnder(pp,2), xi);
r = ((1 + yp.^2).^(3/2)) ./ abs(ypp);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by