Finding the length of square function
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I'm using the square function. I want to find the length of it based on my limits. How can I do that since the square root is discontinues. Regards, Dimo
댓글 수: 4
채택된 답변
Rik
2020년 12월 8일
In general you can approximate the arc length by measuring the distances between the points and adding them.
t=linspace(0,20,100);
X=3*square(2*pi*t/10);
sum(hypot(diff(t),diff(X)))
Just a side note: I found this answer by John D'Errico as the 5th result when I googled 'arc length Matlab' detailing several methods to calculate the arc length. I suggest you take a look there as well.
댓글 수: 0
추가 답변 (1개)
Rafael Hernandez-Walls
2020년 12월 8일
t2=t(find(diff(X)>0));
t1=t(find(diff(X)<0));
long_time=t2(2)-t1(2)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!