How i can make an animation mp4 for the graph?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have found a point 'P(x,y)' connecting 3 points A(6,9),B(20,38),C(49,25) such that the total length PA+PB+PC is minimum by the code
M=500;%we take a fixed value of M
x=6:.01:49; % p is the domain of x
y=9:.01:38; % q is the domain of y
for i=1:length(x)
for j=1:length(y)
L=sqrt((x(i)-6)^2+(y(j)-9)^2)+sqrt((x(i)-20)^2+(y(j)-38)^2)+sqrt((x(i)-49)^2+(y(j)-25)^2);
if L<M
M=L;
a=x(i);
b=y(j);
end
end
end
[a,b]
P(x,y)=(23.1200 29.5000)
Then draw the figure of point P joint three point A,B,C
x = [6 20 49];
y = [9 38 25];
x0 = 23.1200;
y0 = 29.5000;
figure('color','white');
hold on;
for ipt = 1:length(x)
plot([x(ipt) x0],[y(ipt) y0],'color',[0 0 1]);
myChar = char(64+ipt);
text(x(ipt)+0.5,y(ipt)+0.75,myChar);
end
plot(x,y,'P','markerfacecolor','k','markeredgecolor','none', ...
'markersize',4);
plot(x0,y0,'P','markerfacecolor','k','markeredgecolor','none', ...
'markersize',4);
text(x0+0.5,y0+0.75,'P');
xlabel('x');
ylabel('y');
How i can make an animation mp4 of the graph for different value of p ?
Thank you.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Animation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!