Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.93 KB | None | 0 0
  1. %dane modelowe sejsmiki refrakcyjnej
  2. a=load('sejs_2.txt');
  3. figure; hold on;
  4. [Np,Nt]=size(a); %ilosc próbek, ilośc tras
  5. Fs=400;
  6. dx=25;
  7. t=(0:(Np-1))'/Fs;
  8. for k=1:24
  9.     plot(t,a(:,k)+k-1);
  10.     xc=xcorr(a(:,k),a(:,1)); %przesunięcie względem 1. trasy
  11.     FB(k,1)=find(xc==max(xc(:)),1,'first');
  12.     %mamy 24 przesuniecia czasowe
  13.     %musimy przeliczyć przesunięcia na różnice czasu między trasami
  14. end
  15. hold off;
  16. %przesuniecie wzgledem 1.
  17. FB=(FB-Np)/Fs; %odejmujemy ilosc probek
  18. G=ones(Nt,2);
  19. G(:,1)=FB;
  20. x=(0:Nt-1)'*dx;
  21. %v=pinv(G'*G)*G'*x ponieważ [AT*A]^(-1)*AT*b gdy Ax=b
  22. v=pinv(G)*x
  23.  
  24. %szereg fouriera
  25. close all; clear all; clc;
  26. Fs=100;
  27. %zakladamy nieskonczonosc=5
  28. t=-10:(1/Fs):10;
  29. xt=1.0*(abs(t)<1); %sygnal prostokatny o amp=1
  30. XT=ones(size(t))/2; %wektor 1/2
  31. for n=1:50
  32.     an=2*sin(n*pi/2)/(n*pi);
  33.     %zamieniliśmy f nieciągłą na ciągłą
  34.     XT=XT+an*cos(n*pi*t/2);
  35. end
  36. plot(t,xt,'.r',t,XT,'g');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement