% Matlab script stereonet.m
% To plot lines and planes in stereographic
% (equal-angle) projections
clf
% Read input data on planes
load planes.dat
% Data in column 1 are strikes, and data in column 2 are dips
% of planes, with angles given in degrees
strike = planes(:,1)*pi/180;
dip = planes(:,2)*pi/180;
num = length(strike);
% find cyclographic traces of planes and plot them
R = 1;
rake = 0:pi/180:pi;
for i=1:num;
	plunge = asin(sin(dip(i)).*sin(rake));
	trend = strike(i) + atan2(cos(dip(i)).*sin(rake), cos(rake));
	rho = R.*tan(pi/4 - (plunge/2));
	% polarb plots ccl from 3:00, so convert to cl from 12:00
	polarb(pi/2-trend,rho,'-')
	hold on	
end

load lines1.dat
% Data in column 1 are trends, data in column 2 are plunges
% of lines, with angles given in degrees
trend1 = lines1(:,1);
plunge1 = lines1(:,2);
num = length(lines1(:,1));
R = 1;
trendr1 = trend1*pi/180;
plunger1 = plunge1(:,1)*pi/180;
rho1 = R.*tan(pi/4 - ((plunger1)/2));
for i=1:num;
	% polarb plots ccl from 3:00, so convert to cl from 12:00
	polarb(pi/2-trendr1(i),rho1(i),'o')
	hold on	
end

load lines2.dat
% Data in column 1 are trends, data in column 2 are plunges
% of lines, with angles given in degrees
trend2 = lines2(:,1);
plunge2 = lines2(:,2);
num = length(lines2(:,1));
R = 1;
trendr2 = trend2*pi/180;
plunger2 = plunge2*pi/180;
rho2 = R.*tan(pi/4 - ((plunger2)/2));
for i=1:num;
	% polarb plots ccl from 3:00, so convert to cl from 12:00
	polarb(pi/2-trendr2(i),rho2(i),'*')
	hold on	
end


The following file, called lines1.dat, provides an example of an input file for the stereonet plotting program

19	02
43	16
52	03
51	08
110	18
190	02
232 04
235	10
242	30
000	65
340	22
270	34

The file lines2.dat has the same format.

The following file, called planes.dat, provides an example of an input file for the stereonet plotting program

20	20
230	72.5048
