9 Nisan 2010 Cuma

Matlab ile Çöp Adam Çizme Örneği

m7

%www.ethemsulan.com
subplot(2,2,1)
hold on
x=-10:0.01:10;
m1=tan(pi/6);
y=m1*x;
plot(x,y)
hold on
m2=tan(pi/3)
y=m2*x;
plot(x,y)
hold on
m3=tan(pi/2)
y=m3*x;
plot(x,y)
hold on
m4=tan(2*pi/3)
y=m4*x;
plot(x,y)
hold on
m5=tan(5*pi/6)
y=m5*x;
plot(x,y)
hold on
y=zeros(1,size(x,2))
plot(x,y)
hold on
subplot(2,2,2)
hold on
ad=[-8 -6 -4 -6 -6 -8 -4 -6 -6;-6 -4 -6 -4 -2 -2 -2 -2 0]
ad=[ad;ones(1,size(ad,2))]
plot(ad(1,:),ad(2,:))
x1=-8:0.01:-4;
x2=-4:-0.01:-8;
y1=sqrt(4-abs(x1+6).^2)+2;
y2=-sqrt(4-abs(x1+6).^2)+2;
cem=[x1 x2;y1 y2];
plot(cem(1,:),cem(2,:))
cem=[cem;ones(1,size(cem,2))]
d=[1 9]'
d=[d;1]
t1=[1 0 -d(1,1);0 1 -d(2,1);0 0 1]
teta=((pi/2)-acot(1/8))
t2=[cos(teta) -sin(teta) 0;sin(teta) cos(teta) 0;0 0 1]
t3=[-1 0 0;0 1 0;0 0 1]
t4=[cos(teta) sin(teta) 0;-sin(teta) cos(teta) 0;0 0 1]
t5=[1 0 d(1,1);0 1 d(2,1);0 0 1]
t6=[-1 -1 11;-1 0 8;0 0 1]
T=t6*t5*t4*t3*t2*t1;
ncem=T*cem;
nad=T*ad;
plot(ncem(1,:),ncem(2,:)) ;               
plot(nad(1,:),nad(2,:))

Hiç yorum yok:

Yorum Gönder