%% % to save data from a workspace variable to a txt file use: % dlmwrite('New_filemane.txt', workspace_var_name, 'delimiter', '\t') clc %Get that filename and pathname fo...">
Home » Source Code » Fourier Spectrum

Fourier Spectrum

nini
2013-01-29 18:31:27
The author
View(s):
Download(s): 0
Point (s): 1 
Category Category:
MatlabMatlab MatlabMatlab

Description

space:normal;"> %%

% to save data from a workspace variable to a txt file use:

% dlmwrite('New_filemane.txt', workspace_var_name, 'delimiter', '\t')
clc
%Get that filename and pathname for the time series Data file
[filenameD,pathnameD] = uigetfile({

'*.txt';'*.mat'},'Select the Data file');

if

isequal(filenameD,0)

    disp(

'User selected Cancel')

else

   

% display the pathname and filename on the command line

    disp([

'You selected: ', fullfile(pathnameD, filenameD)])

% extract the finelame and the extension

    [token,rem]=strtok(filenameD,

'.');

   

%load the data into the variable D

    D=load(filenameD);

% extract the columns 2 to 9

    D=D(:,2:9);

end

%%

%Get that filename and pathname for the Header file

[filenameH,pathnameH] = uigetfile(

'*.xlsx','Select the Header file');

if

isequal(filenameH,0)

    disp(

'User selected Cancel')

else

    disp([

'You selected: ', fullfile(pathnameH, filenameH)])   

%%%%%% isolate sensor locations in Header format %%%%%%%%%%%%%%%%%%%%

  % gx: receivers x-axis locations 

% gx: receivers y-axis locations

% gz: elevations of the receivers

% sx: sources x-axis locations

% sy: sources y-axis locations

% sz: elevations of the sources

% num_sg: is the number of shot gathers

% num_trace_per_sg: number of traces/shot gather

% dt: the sampling time

% %offset: distance from source to each sensor

% Construct the struct that is required by the Matlab functions.  This can

% be changed later to match our format

    H = struct(

'sx', num2cell(xlsread(filenameH,1, 'A8:H8')),...   

'sy', num2cell(xlsread(filenameH,1, 'A9:H9')),...          

‘sz', num2cell(xlsread(filenameH,1, 'A10:H10')),...

'gx', num2cell(xlsread(filenameH,1, 'A3:H3')),... 

'gy', num2cell(xlsread(filenameH,1, 'A3:H3')),... 

 'gz', num2cell(xlsread(filenameH,1, 'A5:H5')),... 

 'fldr', num2cell(xlsread(filenameH,1, 'A16:H16')),... 

 'dt', num2cell(xlsread(filenameH,1, 'A13:H13')),... 

'offset', num2cell(xlsread(filenameH,1, 'A19:H19')),...

'cdp', num2cell(xlsread(filenameH,1, 'A23:H23'))... ;

save(token,'D', 'H');

clear

filenameD filenameH  pathnameD  pathnameH rem token

end

%%

clear

x t;

[rowsD,colsD]=size(D);

for

i=1:colsD;

x(i)=H(i).offset;

end

%create the time sequence from the header struct

dt=H(1).dt/1e6;

t=0:dt:dt*(length(D)-1);

%%

% the detailed way to do the FFT and plot the spectrum

% [R,f]=fftrl(D,t);

% R=real(todb(R));

% plot(f,R);xlabel('time (sec)')

%%

%alternate way to plot spectrum

dbspec(t,D)

 

 

Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
0.00 B
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
  • 1
  • Page 1
  • Total 1

Fourier Spectrum (2.63 kB)

Need 1 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D