finding the time closest to origin
이전 댓글 표시
I am trying to find the time and distance at which the object is closest to the origin where the x and y coordinates vary with time. THis is what I have. But, something seems to be not working. First I used a point at time t=4 and used for loop to check for all times from 0 to 4.
disp('Finding the closest point')
t=4;
x=5*t- 10;
y= (25*t^2)- 120*t+144;
point =sqrt(x^2+y^2);
for t=0:0.1:4;
x= 5.*t-10;
y= 25.*t.^2- 120.*t+144;
point1= sqrt(x^2+y^2);
if point1<point
xmin=x;
ymin=y;
tmin=t;
end
end
a= 5*tmin- 10;
b= (25 *tmin^2)- 120*tmin +144;
dist=sqrt(a^2+b^2);
disp(dist)
disp(tmin)
댓글 수: 1
vicente estrada
2019년 8월 31일
why was 4 used for t
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!