convert a string to binary vector in matlab
4 stars based on
It is part of the mini course series offered to the incoming Geophysics graduate students at GT. This tutorial consists of the following sections: It was originally developed at Convert binary to ascii matlab Livermore National Laboratory to analyze data in time series, especially seismic data.
It is one of the most widely used data formats and programs in the seismological research community. Related website for requesting a copy of the SAC software is http: To run it, type "sac" in the command line.
If it is not working for some reason, check the following two variables. For the seismic data this means a single data component recorded at a single seismic station. SAC does not currently work on multiplexed data. There is an issue with the SAC binary data. In UNIX, SAC data is stored according to the "big-endian" byte order high-order byte of the number is stored in memory at the lowest address. Use a program called "sacsun2linux" to do the job. Make sure that you only run the program once.
For GT user, please untar convert binary to ascii matlab following file to your home directory, or any subdirectory where you would like to put convert binary to ascii matlab tutorial material. But a file named f See below for examples. SAC restore the original data To learn the syntax of each command, use "help command".
You can use short version of a command. For example, "p" is the same as "plot", convert binary to ascii matlab is the same as "write". SAC Header SAC header consists of important information about the data, such as the sampling interval, start time, length, station location, event location, components, phase arrivals, etc. There parameters will be used by various SAC command to process the data.
It is important to keep your header information complete and updated. To go back to the default listing all headersuse lh default. Current value is the integer 6. This program should also be included in the latest version of SAC. This makes life easy if you need to perform the same type of jobs for many events. Below is a very simple Macro file that reads in three component seismograms and generate a plot with header information convert binary to ascii matlab the title.
Place file id in upper left hand corner. Below I will show a few examples of these tools and functions. Rotate a convert binary to ascii matlab of data. We can easily rotate a pair of data components through an angle in SAC using the "rotate" command. Each pair must have the same station name, convert binary to ascii matlab name, and sampling rate. The most common practice is seismology is to rotate two horizontal component seismograms to be along and perpendicular to the "great circle path" i.
See below for an example of rotating two horizontal seismograms recorded at the broadband station BK. Waveforms recorded at this and other nearby stations are used to study non-volcanic tremor in central California triggered by teleseismic events Peng et al.
Use the cut command to cut them into the same length if needed. Phase picking can be easily done in SAC via automatic phase picker "apk", or manually phase picker "ppk". But this command could mess up the data if you have used the cut command. Lupei Zhu, Professor of Geophysics at St.
Some of these programs are used in this tutorial. See below for a list of the codes available and Disclaimer in the package. It is an university research consortium dedicated to exploring the Earth's interior through the collection and distribution of seismographic data Ref: Basically IRIS is where seismologists get instruments to do seismic experiment, and download seismic data for scientific research.
Other earthquake data centers include: Southern California Earthquake Data Center http: IRIS has a nice tutorial on this: First, please go to the following working directory: You can download waveforms by clicking on the following web page: It will be replaced by Wilber 3. I will update the tutorial later this year. Next choose Q4and the Alaska. Then you will get a page with all events with 5 deg or other specfic range of the clicked point.
Click on the following M6. To make the request relatively modest, let's use the following parameters: Next, we need to select data format, time window and user identifition. After a few minutes, you should get an email notice saying that you data is read to pick up somewhere in an FTP site.
In most case, we will not be able to publish a paper based on only one or two seismograms I was told that people in the early s can do that. In addition, some of the most exciting findings within seismology come from the analysis of massive continous seismic waveforms that are otherwise considered as noise e. Hence, we need to analyze hundreds and thousands sometimes even more of seismic data first.
How can we do that? Basically we have to reply on computers to do most of the dirty job. Below are some examples to show how convert binary to ascii matlab can interact with SAC using shell script. Convert binary to ascii matlab backup move the rest into backup for now Example 2: An convert binary to ascii matlab step in data processing is to document what we have done to the data, so that other people can reproduce your results.
Also sometimes you convert binary to ascii matlab to reprocess the data, but maybe you have forgot the commands and parameters you have typed a few months ago. There are two ways to document your scripts. The first way is simply to write a shell script. This could be assigned as a potential homework for you. You can define different steps using flags, and simply copy the command line from the above examples into each step. Another way is to write a Makefile, and put each step seperately.
Makefile was originally used for convert binary to ascii matlab a collection of computer codes. It can be used to convert binary to ascii matlab simple commands if puting them in a seperate shell script file is not needed.
See Makefile in your working directory. For example, if you want to redo step 3, simply type "make step3" in your command line, it will automatically execute what is written underneath the flag step3.
If you want to clean up all you have done here, simply type "make clean". If you want to reprocess all the steps, type "make all". Additional tutorial on Makefile can be found online, such as Make a tutorial. Lupei Zhu at SLU. The answer is yes. Lupei Zhu at SLU wrote convert binary to ascii matlab code called "pssac" that can do the job.
The source code of "pssac" can be downloaded from the following link: Please note that right now pssac is not compatible with convert binary to ascii matlab latest version of GMT. Zhu and I will contact Dr.
The syntax of pssac is very similar to a typical GMT command. Below are two simple examples. The second plot the three component and radial and transverse component data at station GSC. Below is an example. These subroutines are in MatSAC directory. To read a SAC file into Matlab, use the following syntax: It will generate the third panel that shows the spectrogram i.
It needs a subroutine called eqfiltfilt. It will convert binary to ascii matlab the raw seismic data, apply a 0. SRL, for why doing thisand convert the seismic data into audible sounds. If it works, you will generate an audible seismogram like this BK. It has a SeisSound Repositorywhich contains various animations with sounds made from USArray and other openly available data from IRIS, and a source code if you would like to make them by yourselves.
Please click the following link for URL Builder: The click the link on that page, or below to download the audio files. CCO and generated by a repeating cluster along the Calaveras fault in central California. This station recorded clear fault zone head waves that refract along the bi-material fault interface, and has been studied in Zhao and Peng GRL,