use of matlab for analysis and plotting of accoustic well data

of 21 /21
Use of Matlab for Analysis and Plotting of Accoustic Well Data

Author: brittany-turner

Post on 28-Dec-2015

222 views

Category:

Documents


0 download

Embed Size (px)

TRANSCRIPT

  • Use of Matlab for Analysis and Plotting of Accoustic Well Data

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    HomeOpen and converting dataOperators and comandsHandling graphicsStart Matlab

    M-filesIntroductionProgram ExerciseResourcesQuiz

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    IntroductionMATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation

    MATLAB is an interactive, matrix based system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar non interactive language such as C or Fortran

    However, the speed when running a Matlab script or function may be described as slow as a turtle compared to Fortran (fast as a rabbit)

    The name MATLAB stands for MATrix LABoratory. Matlab may More

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    IntroductionMATLAB may be used directly from the command window, but you should use m-file programming. This is quite similar to Fortran programming but the file is denoted .m rather than .f

    There are two types of m-files; scripts and functions, where the first is the simplest and easiest-to-use.

    When you invoke a script, MATLAB simply executes the commands found in the file. Scripts can operate on existing data in the workspace, or they can create new data on which to operate. In addition, scripts can produce graphical output using functions like plot.

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Start MatlabThere are two ways you can start Matlab:

    In Windows from your Start MenuIn Unix, logged on Petra, simply write matlab in the terminal window

    Creating m-files in:

    Windows: when you have started matlab, click file-> new-> m-fileUnix: use a text editor, emacs is preferred (type emacs file.m)

    Running m-files: type the name of the file (without .m; if the filename is test.m, type test) in the matlab command window and hit enter (both Windows and Unix)

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Open and Controlling DataWhen you have created an m-file, you should start your script by opening the file from which your data is to be imported

    For a file in ASCII format use the following command:

    fp = fopen( c33.dat , r )

    opens the file c33.dat and labels it fp

    For control of your data you should convert it into a matrix

    To do so, you should use the command

    [w,c] = fscanf(fp,'%e %e %e %e %e %e %e %e',[8, inf])

    reads data from fp in e-format (%e) into the matrix w that has 8 columns and unknown number of rows (8, inf)

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    OperatorsArithmethic operators in matlab are the familiar expressions:

    + - / * ^

    Note: If you want to perform an element by element operation of two or more matrices, instead of / * ^, use ./ .* .^

    If you want to extract the first column from a matrix x and store it as the variable v, use the following command:z = x(1,:)

    If you want to make a new vector acimp(i)=vp(i)*rho(i), use:

    acimp = vp.*rho

    where vp and rho has already been defined

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Handling GraphicsMATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs

    Creating a plot:plot(x, y) produces a graph of y vs x

    Multiple graphs in one figure:plot(x1, y1, x2, y2, ...)

    Typically, you often want to plot several different plots in different windows for easy comparison. To do so use the command:figure(n)where n is the number of the figure

    Colors and StylesSubplots

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Colors and StylesIt is possible to specify color, linestyle, and markers, such as plus signs or circles, with: plot(x,y,'color_style_marker')

    Color strings are 'c', 'm', 'y', 'r', 'g', 'b', 'w', and 'k'. These correspond to cyan, magenta, yellow, red, green, blue, white, and black.

    Linestyle strings are '-' for solid, '- -' for dashed, ':' for dotted, '-.' for dash-dot, and 'none' for no line.

    The most common marker types include '+', 'o', '*', and 'x'. Plot(x,y,c:+) plots a cyan, dotted line and places plus sign markers at each data point

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    SubplotsThe subplot function allows you to display multiple plots in the same window:subplot(m,n,p)

    breaks the figure window into an m-by-n matrix of small subplots and selects the pth subplot for the current plot.

    Subplots are best illustraded with an example

    Example

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Program ExerciseIn this exercise we will be using accoustic well logs from well C-33 in the Gullfaks field. This well is one of few wells on Gullfaks that has also been logged some distance above the actual reservoir. In addition, shear wave velocities has also been logged.

    The file c33.dat (can be downloadedfrom the course homepage), contains the following data:

    Column 1: Depth in metersColumn 2: P-wave velocity (m/s)Column 3: Density, r, (g/ccm)Column 4: P-wave velocity for 10% water saturationColumn 5: Density, r, for 10% water saturationColumn 6 :P-wave velocity for 80% water saturationColumn 7 :Density, r, for 80% water saturationColumn 8 :S-wave velocity (m/s)

    Next

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Program ExerciseUse MATLAB to read all data from c33.dat to a matrice with 8 columns. Plot Vp , Vs and r as a function of depth. Plot the three curves below each other.

    Use MATLAB to compute accoustic impedance (Vp* r) and shear wave accoustic impedance (Vs* r), and plot the two impedances either in the same plot or in to equal plots right below each other. This way, a comparison between the two curves can easily be made.

    Compute the Vp/Vs ratio. Comment the deflections around top Kritt (ca 1675 m) and top Brent (1835 m). Also compute the difference in p-wave velocity between 10% and 80% water saturation as a function of depth.

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Program ExerciseIn seismic AVO-analysis and inversion it is common to use Elastic Impedance. Elastic Impedance (EI) is defined as

    where

    Compute Elastic Impedance as a function of depth and make a plot where you plot both accoustic impedance and elastic impedance (vs depth). Assume that q is 30 degrees. Comment the difference between the two curves, again particularly around top Kritt and top BrentUseful InfoResources

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    ResourcesThe whole exercise in a printable format here

    Web sites:

    http://www.stud.ntnu.no/info/programmer/matte/matlab/matlab-info.html

    http://www.ntnu.no/itea.info/programvare/matlabdoc/rel11doc/techdoc/basics/getstarted.html

    Short list of MATLAB CommandsUseful Info

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    Useful InfoIf you simply type a statement and press Return or Enter, MATLAB automatically displays the results on screen. However, if you end the line with a semicolon, MATLAB performs the computation but does not display any output. This is particularly useful when you generate large matrices. For example

    A = magic(100);

    As long as you do not want a computation to be shown on the screen, you should always include a semicolon at the end of each line

    Resources

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    QuizThis section includes a quiz on the topics covered by this module.

    The quiz is meant as a control to see if you have learned some of the most important features

    Hit object to start quiz (Depending on your connection, this may take a few seconds...)

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    General informationAbout the author

    Thor A. Thorsen - incling sound, video, animation files

    Thor A. Thorsen - for example Geophysics -> Processing

    Thor A. Thorsen - 0 is very easy 4 is most difficult

    Thor A. Thorsen - in minutesThor A. Thorsen - Individual learning or project-based learningThor A. Thorsen - Title with reference to version number starting with 1.0Thor A. Thorsen - Flash-player, etc.Thor A. Thorsen - With link to an web-site with contact information, taks and publicationsJonny Hesthammer - Ideally, this link should be to the authors web homepage as this will ensure continuous update of adresses, publications etc. However, for those who have not yet created their own homepage we provide a separate page in this document for author information. The current link is to that page and it must be changed (right click with mouse on action button and select "edit hyperlink") to the relevant web link.

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    FAQNo questions have been posted yet. However, when questions are asked they will be posted here.

    Remember, if something is unclear to you, it is a good chance that there are more people that have the same question

    For more general questions and definitions try these

    Dataleksikon

    Webopedia

    Schlumberger Oilfield Glossary

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    ReferencesGetting started with Matlab

    http://www.ntnu.no/itea.info/programvare/matlabdoc/rel11doc/techdoc/basics/getstarted.html

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    SummarySubsequent to this module you should...

    be familiar with Matlab and how to use it to visualize computed dataknow how to use scripts in Matlab

    FAQReferencesSummaryInfoResourcesIntroductionStart MatlabOpen and controlling dataOperatorsHandling GraphicsProgram ExerciseUseful InfoQuiz

    ExampleSee the plots this matlab script would produce:Figure 1Figure 2Back