早教吧作业答案频道 -->其他-->
Matlab 曲线到定点距离最短问题已知x(t)=5t-10,y(t)=25t^2-120t+144.t在[0,4]之间,求曲线到(0,0)的最短距离.
题目详情
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],'--');
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],'--');
看了 Matlab 曲线到定点距离...的网友还看了以下:
磁场强度与距离什么关系永磁铁氧体的磁感强度B与距离R的关系,如一永磁铁氧体的磁感强度B为0.5T, 2020-05-14 …
高一物理匀变速直线运动做匀变速直线运动的质点,位移随时间变化规律为x=24t-1.5t^2,则质点 2020-06-06 …
如图所示,两根相距l=0.4m、电阻不计的平行光滑金属导轨水平放置,一端与阻值R=0.15Ω的电阻 2020-06-14 …
(2014•赤峰样卷)如图,过点A(0,3)的直线l1与x轴交于点B,tan∠ABO=34.过点A 2020-06-19 …
如图,两根相距L=0.8m,电阻不计的平行光滑金属导轨水平放置,一端与阻值R=0.3Ω的电阻相连, 2020-07-06 …
1.已知{x=-1+3/5t是方程x+y=4的解,求t{y=-2+4/5t2.方程组{2x-3y=4 2020-10-31 …
如图,两根相距L=0.8m、电阻不计的平行光滑金属导轨水平放置,一端与阻值R=0.3Ω的电阻相连.导 2020-12-20 …
如图,两根相距l=0.4m、电阻不计的平行光滑金属导轨水平放置,一端与阻值R=0.15Ω的电阻相连. 2020-12-20 …
如图,两根相距L=0.4m、电阻不计的平行光滑金属导轨水平放置,一端与阻值R=0.15Ω的电阻相连. 2020-12-20 …
如图16-4-17所示,水平放置的光滑导电轨道,处在磁感应强度为B=0.5T、方向向上的匀强磁场中, 2020-12-20 …