Matlab 曲线到定点距离最短问题
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/09/02 10:55:18
Matlab 曲线到定点距离最短问题
已知x(t)=5t-10,y(t)=25t^2-120t+144.
t在[0,4]之间,求曲线到(0,0)的最短距离.
已知x(t)=5t-10,y(t)=25t^2-120t+144.
t在[0,4]之间,求曲线到(0,0)的最短距离.
You can use Matlab's symbolic package to get the minimum distance, you might need to use a little bit calculus
t = sym('t','real') % define a real symbol variable
x=5*t-10;
y=25*t.^2-120*t+144;
d = (x^2+y^2)^.5; % distance function
d1 = diff(d); % the differentiation
t1s = solve(d1); % let the differentiation equal to 0 to get the maxmin point
t1v = eval(t1s); % get the numerical evaluation
min_d = subs(d,t,t1v)
min_d =
1.3577
You can use the following code to generate a figure of illustrating the curve and the distance:
t = [0:0.001:4];
x=5*t-10;
y=25*t.^2-120*t+144;
figure(1);
hold on;
plot(x,y,'b');
axis([0 4 0 4],'square');
x=5*t-10;
d=(x.^2+y.^2).^.5;
figure(1);
hold on;
plot(x,d,'g');
t=t1v;
x=5*t-10;
y=25*t.^2-120*t+144;
plot(x,y,'r.');
plot([0 x],[0 y],'r');
plot([x x],[0 4],'--');
再问: And one more question, how to determine x, y at which the curve is the closest to the origin(0,0)? Thank you~
再答: when you have the parameter t, you can simply substitute it into the formula to obtain x and y, in my code: t=t1v; x=5*t-10; y=25*t.^2-120*t+144; And the point is a red point on the figure.
t = sym('t','real') % define a real symbol variable
x=5*t-10;
y=25*t.^2-120*t+144;
d = (x^2+y^2)^.5; % distance function
d1 = diff(d); % the differentiation
t1s = solve(d1); % let the differentiation equal to 0 to get the maxmin point
t1v = eval(t1s); % get the numerical evaluation
min_d = subs(d,t,t1v)
min_d =
1.3577
You can use the following code to generate a figure of illustrating the curve and the distance:
t = [0:0.001:4];
x=5*t-10;
y=25*t.^2-120*t+144;
figure(1);
hold on;
plot(x,y,'b');
axis([0 4 0 4],'square');
x=5*t-10;
d=(x.^2+y.^2).^.5;
figure(1);
hold on;
plot(x,d,'g');
t=t1v;
x=5*t-10;
y=25*t.^2-120*t+144;
plot(x,y,'r.');
plot([0 x],[0 y],'r');
plot([x x],[0 4],'--');
再问: And one more question, how to determine x, y at which the curve is the closest to the origin(0,0)? Thank you~
再答: when you have the parameter t, you can simply substitute it into the formula to obtain x and y, in my code: t=t1v; x=5*t-10; y=25*t.^2-120*t+144; And the point is a red point on the figure.
【平面几何】求做直线,使定点到该直线的距离之和最短
已知一条曲线上任意一点到定点O(0,0)的距离是到定点A(3,0)距离的两倍,求这条曲线的方程.
MATLAB绘制曲线问题
用matlab通过10个已知点求一未知点坐标,使该未知点点到其他点的距离只和最短
椭圆中什么点到焦点的距离最短?
曲线上任意一点到定点F(5.0)的距离及定直线m:x=16/5的距离之比为5/4,求曲线方程
matlab画函数曲线问题
matlab拟合曲线的问题!
Matlab求曲线方程问题
分类整理,什么最短位移,下漂距离,最短时间,“最”问题,
曲线和方程 求到定点F(1,0)的距离等于到直线x+1=0的距离的动点P的轨迹的方程.
曲线方程{x=tanθ-1 y=1/tanθ上求一点P使他到直线x+2y=3的距离最短,并求出最小距离