花画圆的程序:
for i=-3:0.001:3
y=-sqrt(9-i^2);
plot(i,y);
hold on
end
hold on
for i=-3:0.001:3
y=sqrt(9-i^2);
plot(i,y);
hold on
end
%椭圆
for i=-6:0.01:6
y=-sqrt(36-i^2)/2;
plot(y,i);
hold on
end
%双曲线
for i=-6:0.01:6
y=-sqrt(36+i^2)/2;
plot(y,i);
hold on
end
hold on
for i=-6:0.01:6
y=sqrt(36+i^2)/2;
plot(y,i);
hold on
end
hold on
for i=-6:0.01:6
y=sqrt(36-i^2)/2;
plot(y,i);
hold on
end
%抛物线
for i=0:0.01:6
y=-sqrt(2*6*i);
plot(y,i);
hold on
end
hold on
for i=0:0.01:6
y=sqrt(2*6*i);
plot(y,i);
hold on
end