Plotting Programs for Earthquake Simulation

Plotting Programs for Earthquake Simulation

Updated 08/12/04

The following programs will plot an outline of the state of Maryland, plot points for those sites participating in the earthquake simulation, ask for the user to select three sites and enter the distance to the epicenter from each site, plot circles around those three sites and ask the user to select a point for the epicenter. Thanks to Mary Ellen Verona for the main part of the plotting routines.


Main plotting Routine


% Plots for MD Earthquake simulation

clear;
hold off;
load mdout.dat
min=mdout(:,2);
long = -(mdout(:,1) + min/60);
min = mdout(:,4);
lat = mdout(:,3) + min/60;
plot(long,lat);

load site.dat;
sitlon = site(:,2);
sitlat = site(:,1);
hold on;
plot (sitlon,sitlat,'*g');
axis('equal');
disp('first station');
seis1=ginput(1);
r(1)=input('Distance in km to epicenter ');
plot(seis1(1),seis1(2),'*m');
disp('second station');
seis2=ginput(1);
r(2)=input('Distance in km to epicenter ');
plot(seis2(1),seis2(2),'*m');
disp('third station');
seis3=ginput(1);
r(3)=input('Distance in km to epicenter ');
plot(seis3(1),seis3(2),'*m');
hold off;

p=circplt1(seis1,r(1),'r');
axis('equal');
p=circplt1(seis2,r(2),'b');
p=circplt1(seis3,r(3),'g');
plot(long,lat);

epi = ginput(1)


Function called by the program above

Name this program circplt.m
%Function called by mdquakeplot program

function p=circplt1(seis,radius,color)
p=radius/111.133;
[xa xb y]=circ2(seis,p);
plot(seis(1),seis(2),'+c');
hold on;
plot(xa,y,color);
plot(xb,y,color);

Function called by the program above

Call this program circ2.m
%Function called by circplt1 function which is part of
%mdquakeplot program

function [xa,xb,y]=circ2(cent,p)
y=cent(2)-p:0.02:cent(2)+p;
rad=sqrt(p^2-cent(2)^2-y.^2+2*cent(2)*y);
xa=rad*1.3+cent(1);
xb=-1*rad*1.3+cent(1);

Data file for the outline of Maryland

Called mdout.dat
79	30	39	12	
79	29	39	43	
75	48	39	43	
75	44	38	28	
75	2	38	28	
75	3	38	25	
75	4	38	21	
75	6	38	20	
75	9	38	19	
75	14	38	15	
75	16	38	13	
75	17	38	7	
75	20	38	7	
75	22	38	4	
75	23	38	2	
75	29	38	2	
75	38	38	1	
75	48	37	58	
75	53	37	57	
75	54	38	0	
75	52	38	3	
75	46	38	6	
75	51	38	6	
75	51	38	8	
75	47	38	9	
75	56	38	9	
75	56	38	12	
75	50	38	14	
75	54	38	17	
75	51	38	24	
75	58	38	17	
76	0	38	19	
75	58	38	20	
75	59	38	23	
76	3	38	20	
76	2	38	14	
76	7	38	18	
76	14	38	24	
76	14	38	19	
76	17	38	24	
76	20	38	29	
76	11	38	33	
76	12	38	35	
76	18	38	36	
76	18	38	38	
76	11	38	39	
76	6	38	41	
76	10	38	41	
76	10	38	43	
76	13	38	43	
76	13	38	46	
76	20	38	42	
76	21	38	46	
76	16	38	50	
76	10	38	48	
76	10	38	51	
76	9	38	55	
76	12	38	54	
76	13	38	56	
76	20	38	55	
76	18	39	1	
76	14	38	59	
76	10	39	0	
76	6	39	5	
76	4	39	8	
76	10	39	9	
76	12	39	3	
76	17	39	10	
76	8	39	23	
75	50	39	22	
76	1	39	24	
75	54	39	28	
75	50	39	28	
75	54	39	30	
75	51	39	35	
76	0	39	29	
75	56	39	37	
76	1	39	33	
76	5	39	34	
76	8	39	31	
76	5	39	27	
76	12	39	23	
76	14	39	28	
76	16	39	24	
76	15	39	21	
76	16	39	19	
76	20	39	25	
76	24	39	24	
76	21	39	21	
76	23	39	17	
76	30	39	19	
76	24	39	13	
76	30	39	13	
76	30	39	11	
76	27	39	10	
76	26	39	5	
76	31	39	5	
76	24	39	1	
76	27	38	59	
76	35	39	4	
76	27	38	55	
76	32	38	57	
76	30	38	55	
76	33	38	54	
76	29	38	50	
76	33	38	46	
76	31	38	43	
76	30	38	32	
76	23	38	23	
76	26	38	20	
76	38	38	30	
76	42	38	41	
76	41	38	29	
76	32	38	23	
76	29	38	20	
76	22	38	18	
76	23	38	15	
76	20	38	10	
76	19	38	3	
76	25	38	6	
76	27	38	13	
76	31	38	8	
76	36	38	14	
76	43	38	16	
76	47	38	15	
76	48	38	21	
76	52	38	23	
76	51	38	20	
76	50	38	18	
76	53	38	16	
76	59	38	22	
77	2	38	29	
77	5	38	26	
77	6	38	27	
77	9	38	27	
77	7	38	24	
77	11	38	21	
77	15	38	26	
77	17	38	29	
77	14	38	33	
77	12	38	33	
77	11	38	37	
77	7	38	37	
77	7	38	42	
77	3	38	41	
77	1	38	43	
77	1	38	48	
76	55	38	55	
77	3	39	1	
77	7	38	57	
77	17	39	4	
77	23	39	5	
77	28	39	5	
77	31	39	9	
77	28	39	14	
77	34	39	19	
77	37	39	20	
77	45	39	21	
77	44	39	25	
77	49	39	28	
77	47	39	30	
77	53	39	33	
77	50	39	36	
78	3	39	37	
78	12	39	41	
78	17	39	39	
78	27	39	37	
78	25	39	33	
78	35	39	32	
78	46	39	35	
78	45	39	37	
78	48	39	39	
78	56	39	27	
79	6	39	29	
79	16	39	19	
79	22	39	19	
79	29	39	12	


Data File for the Participating Sites

Called site.dat

39.62 -79.32
39.33 -76.60
39.05 -76.07
39.00 -76.69
39.07 -76.68
39.55 -76.10
38.60 -77.17
39.60 -75.94
38.37 -75.60
39.01 -77.03
39.65 -77.56
39.60 -77.82
39.48 -77.35
38.30 -76.65
39.58 -77.02