bai6 do thi hinh tron
function bai6
a1= input('Nhap a1: ');
a2= input('Nhap a2: ');
b1= input('Nhap b1: ');
b2= input('Nhap b2: ');
i=0;
while i==0
R1=input('Nhap R1: ');
if R1 > 0
i=1;
else
disp('* Ban da nhap sai yeu cau nhap lai R1 *')
end
end
i=0;
while i==0
R2=input('Nhap R2: ');
if R2 > 0
i=1;
else
disp('* Ban da nhap sai yeu cau nhap lai R2 *')
end
end
x1=linspace(-a1-R1,-a1+R1,1000);
x2=linspace(-a2-R2,-a2+R2,1000);
y1= ((R1^2 - (x1+a1).^2)).^(1/2) - b1;
y2= -((R1^2 - (x1+a1).^2)).^(1/2) - b1;
y3= ((R2^2 - (x2+a2).^2)).^(1/2) - b2;
y4= -((R2^2 - (x2+a2).^2)).^(1/2) - b2;
hold on
plot(x1,y1);
plot(x1,y2);
plot(x2,y3);
plot(x2,y4);
axis equal;
Bạn đang đọc truyện trên: Truyen247.Pro