Reshuffled stack data plot

2 vues (au cours des 30 derniers jours)
davit petraasya
davit petraasya le 23 Fév 2016
Hi
I am doing seismology plot. I have magnitudes(Y) and time(X). My magnitude changes from 1.1 till 4. Time in years 1969-2015.(3and 4-coloms in attached file)
I need to take all magnitudes bigger or equal 3 and look at how many points I have before and after 60 days from the Mag>=3 points. (all magnitudes should be taken in 120 days).
I tryed to solve it. I think it has 25 Magnitude >= 3 points and looked at how many magnitudes I have before and after 60 days from the mag >=3. Noticingly Magnitudes should be reshuffled.(it should not be original magnitudes). Finally I should stack all the 25 points results in one plot. I wrote code,it is working but not correct. I should not get peak at zero day. What would be my mistake?
Thanks!
[NUMERIC,TXT,RAW]=XLSREAD('oneLshock.xlsx'); x=NUMERIC(:,2); y=NUMERIC(:,1); Mag=NUMERIC(:,3);
for iii=1:length(TXT); date_str(iii,:)=TXT(iii,4); end
date_num=datenum(date_str,'dd/mm/yyyy');
date1=datenum('01/01/1955','dd/mm/yyyy'); date2=datenum('01/01/2016','dd/mm/yyyy');
A=-0.59; B=43.45; L=0.09; x11=A-L; x22=A+L; y11=B-L; y22=B+L;
Mag=Mag(randperm(length(Mag))); condition = ( Mag >= 3 & x > x11 & x < x22 & y > y11 & y < y22 & date_num > date1 & date_num < date2);
shock = zeros(121,1); date_num_diff = date_num(condition); for i=1:length(date_num_diff) ddi = date_num - date_num_diff(i); k = (ddi <= 60 & ddi >= -60); k60 = ddi(k); for ki = 1:length(k60) shock(k60(ki)+61)= shock(k60(ki)+61) + 1; end end
plot(-60:60,shock,'r'); xlabel('Time(days)','fontweight','bold','fontsize',10); ylabel('Numbers(M>3)','fontweight','bold','fontsize',10); title('Lacq 1L shocks','fontweight','bold','fontsize',10); grid on;

Réponses (0)

Catégories

En savoir plus sur Chemistry dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by