Рет қаралды 2,148
Code:
clc
clear all
close all
warning off
t=0:0.3:2*pi;
x1=30*cos(t)+randn(1,length(t));
y1=30*sin(t)+randn(1,length(t));
z=zeros(1,length(t));
plot3(x1,y1,z,'ro','linewidth',2);
xlim([-100 100])
ylim([-100 100])
zlim([0 1])
hold on;
pause;
t=0:0.3:2*pi;
x2=90*cos(t)+randn(1,length(t));
y2=90*sin(t)+randn(1,length(t));
z=zeros(1,length(t));
plot3(x2,y2,z,'ko','linewidth',2);
pause;
syms x y;
fg=exp(-(x^2+y^2)/1000);
ms=fsurf(fg,[-100 100 -100 100]);
ms.FaceAlpha = 0.4;
ms.EdgeColor = 'none';
hold on;
pause;
z1=exp(-(x1.^2+y1.^2)/1000);
z2=exp(-(x2.^2+y2.^2)/1000);
for i=1:length(t)
plot3([x1(i) x1(i)],[y1(i) y1(i)],[0 z1(i)],'r','linewidth',2);
plot3(x1(i),y1(i),z1(i),'ro','linewidth',4);
pause(0.3);
end
for i=1:length(t)
plot3([x2(i) x2(i)],[y2(i) y2(i)],[0 z2(i)],'k','linewidth',2);
end
plot3(x2,y2,z2,'ko','linewidth',4);
pause;
z=(max(z2)+0.5*(max(z2)+min(z1)));
ms=fsurf(z,'g');
ms.FaceAlpha = 0.2;
ms.EdgeColor = 'none';
Learn Machine Learing with MATLAB:
• Importing Dataset | MA...
#MachineLearning #MATLAB