22 Nisan 2010 Perşembe

Matlab ile Kum Saati Çizme Örneği

m18

%www.ethemsulan.com
close all
clear all
clc
subplot(2,2,1)
z = 0:pi/50:2*pi;
x=sin(z);
y=cos(z);
cember=[x ;y ;z ]
plot3(cember(1,:),cember(2,:),cember(3,:)*0,'color','red','linewidth',2);
hold on
plot3(cember(1,:),cember(2,:),cember(3,:)*0+20,'color','red','linewidth',2);
hold on
kenar=[-1 -1;0 0;0 20 ]
plot3(kenar(1,:),kenar(2,:),kenar(3,:),'color','red','linewidth',2);
hold on
plot3(-kenar(1,:),kenar(2,:),kenar(3,:),'color','red','linewidth',2);
hold on
%plot3(kenar(2,:),kenar(1,:),kenar(3,:),'color','red','linewidth',2);
%hold on
%plot3(kenar(2,:),-kenar(1,:),kenar(3,:),'color','red','linewidth',2);
%hold on
kenarcap=[-1 1;0 0;0 20 ]
plot3(kenarcap(1,:),kenarcap(2,:),kenarcap(3,:),'color','red','linewidth',2);
hold on
plot3(-kenarcap(1,:),kenarcap(2,:),kenarcap(3,:),'color','red','linewidth',2);
hold on
orta=[-1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(1,:),orta(2,:),orta(3,:),'color','red','linewidth',2);
hold on
orta=[1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(1,:),orta(2,:),orta(3,:),'color','red','linewidth',2);
hold on
orta=[0 0;-1 0;0 10];
plot3(orta(1,:),orta(2,:),orta(3,:),'color','red','linewidth',2);
hold on
cap=[-1 1;0 0;0 0];
plot3(cap(1,:),cap(2,:),cap(3,:),'color','red','linewidth',2);
hold on
cap=[-1/sqrt(2) 1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(1,:),cap(2,:),cap(3,:),'color','red','linewidth',2);
hold on
cap=[1/sqrt(2) -1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(1,:),cap(2,:),cap(3,:),'color','red','linewidth',2);
hold on
title('KUM SAATI')
xlabel('X ekseni')
ylabel('Y ekseni')
zlabel('Z ekseni')
grid on
box on
hold on
axis square
subplot(2,2,2)
z = 0:pi/50:2*pi;
x=sin(z);
y=cos(z);
cember=[x ;y ;z ]
plot3(cember(3,:)*0,cember(1,:),cember(2,:),'color','red','linewidth',2);
hold on
plot3(cember(3,:)*0+20,cember(1,:),cember(2,:),'color','red','linewidth',2);
hold on
kenar=[-1 -1;0 0;0 20 ]
plot3(kenar(3,:),kenar(1,:),kenar(2,:),'color','red','linewidth',2);
hold on
plot3(kenar(3,:),-kenar(1,:),kenar(2,:),'color','red','linewidth',2);
hold on
kenarcap=[-1 1;0 0;0 20 ]
plot3(kenarcap(3,:),kenarcap(1,:),kenarcap(2,:),'color','red','linewidth',2);
hold on
plot3(kenarcap(3,:),-kenarcap(1,:),kenarcap(2,:),'color','red','linewidth',2);
hold on
orta=[-1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(3,:),orta(1,:),orta(2,:),'color','red','linewidth',2);
hold on
orta=[1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(3,:),orta(1,:),orta(2,:),'color','red','linewidth',2);
hold on
orta=[0 0;-1 0;0 10];
plot3(orta(3,:),orta(1,:),orta(2,:),'color','red','linewidth',2);
hold on
cap=[-1 1;0 0;0 0];
plot3(cap(3,:),cap(1,:),cap(2,:),'color','red','linewidth',2);
hold on
cap=[-1/sqrt(2) 1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(3,:),cap(1,:),cap(2,:),'color','red','linewidth',2);
hold on
cap=[1/sqrt(2) -1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(3,:),cap(1,:),cap(2,:),'color','red','linewidth',2);
hold on
title('KUM SAATI')
xlabel('X ekseni')
ylabel('Y ekseni')
zlabel('Z ekseni')
grid on
box on
hold on
axis square
subplot(2,2,3)
z = 0:pi/50:2*pi;
x=sin(z);
y=cos(z);
cember=[x ;y ;z ]
plot3(cember(2,:),cember(3,:)*0,cember(1,:),'color','red','linewidth',2);
hold on
plot3(cember(2,:),cember(3,:)*0+20,cember(1,:),'color','red','linewidth',2);
hold on
kenar=[-1 -1;0 0;0 20 ]
plot3(kenar(2,:),kenar(3,:),kenar(1,:),'color','red','linewidth',2);
hold on
plot3(kenar(2,:),kenar(3,:),-kenar(1,:),'color','red','linewidth',2);
hold on
kenarcap=[-1 1;0 0;0 20 ]
plot3(kenarcap(2,:),kenarcap(3,:),kenarcap(1,:),'color','red','linewidth',2);
hold on
plot3(kenarcap(2,:),kenarcap(3,:),-kenarcap(1,:),'color','red','linewidth',2);
hold on
orta=[-1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(2,:),orta(3,:),orta(1,:),'color','red','linewidth',2);
hold on
orta=[1/sqrt(2) 0;-1/sqrt(2) 0;0 10];
plot3(orta(2,:),orta(3,:),orta(1,:),'color','red','linewidth',2);
hold on
orta=[0 0;-1 0;0 10];
plot3(orta(2,:),orta(3,:),orta(1,:),'color','red','linewidth',2);
hold on
cap=[-1 1;0 0;0 0];
plot3(cap(2,:),cap(3,:),cap(1,:),'color','red','linewidth',2);
hold on
cap=[-1/sqrt(2) 1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(2,:),cap(3,:),cap(1,:),'color','red','linewidth',2);
hold on
cap=[1/sqrt(2) -1/sqrt(2);-1/sqrt(2) 1/sqrt(2);0 0];
plot3(cap(2,:),cap(3,:),cap(1,:),'color','red','linewidth',2);
hold on
title('KUM SAATI')
xlabel('X ekseni')
ylabel('Y ekseni')
zlabel('Z ekseni')
grid on
box on
hold on
axis square

Hiç yorum yok:

Yorum Gönder