Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 4b194777eaf705e440bb2ce282d32772 > files > 558

GMT-doc-4.5.3-3.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>7.13 Plotting of vector fields</TITLE>
<META NAME="description" CONTENT="7.13 Plotting of vector fields">
<META NAME="keywords" CONTENT="GMT_Docs">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="GMT_Docs.css">

<LINK REL="next" HREF="node135.html">
<LINK REL="previous" HREF="node133.html">
<LINK REL="up" HREF="node121.html">
<LINK REL="next" HREF="node135.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4532"
  HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4526"
  HREF="node121.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4520"
  HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4528"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4530"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4533"
  HREF="node135.html">7.14 Gridding of data</A>
<B> Up:</B> <A NAME="tex2html4527"
  HREF="node121.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4521"
  HREF="node133.html">7.12 Optimal triangulation of</A>
 &nbsp; <B>  <A NAME="tex2html4529"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4531"
  HREF="node256.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015130000000000000000"></A>
<A NAME="24455"></A>
<BR>
7.13 Plotting of vector fields
</H1>

<P>
In many areas, such as fluid dynamics and elasticity,
it is desirable to plot vector fields of various kinds.
<A NAME="tex2html1389"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> provides a way to illustrate 2-component vector fields
using the <A NAME="tex2html1390"
  HREF="../man/grdvector.html"><I><B>grdvector</B></I></A><A NAME="25140"></A> utility.  The two components of
the field (Cartesian or polar components) are stored in
separate grid files.  In this example we use <A NAME="tex2html1391"
  HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="25145"></A>
to generate a surface <!-- MATH
 $z(x, y) = x \cdot \exp(-x^2 -y^2)$
 -->
<IMG
 WIDTH="170" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
 SRC="img170.png"
 ALT="$z(x, y) = x \cdot \exp(-x^2 -y^2)$">
and to calculate <IMG
 WIDTH="22" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
 SRC="img171.png"
 ALT="$\nabla z$"> by
returning the <I>x</I>- and <I>y</I>-derivatives separately.
We superpose the gradient vector field and the surface
<I>z</I> and also plot the components of the gradient
in separate windows.
A <A NAME="tex2html1392"
  HREF="../man/pstext.html"><I><B>pstext</B></I></A><A NAME="25150"></A> call to place a header finishes the plot
(Figure&nbsp;<A HREF="#fig:GMT_example_13">7.13</A>:

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 13
#
# Purpose:      Illustrate vectors and contouring
# GMT progs:    grdmath, grdcontour, grdvector, pstext
# Unix progs:   echo, rm
#
ps=example_13.ps
grdmath -R-2/2/-2/2 -I0.1 X Y R2 NEG EXP X MUL = z.nc
grdmath z.nc DDX = dzdx.nc
grdmath z.nc DDY = dzdy.nc
grdcontour dzdx.nc -JX3i -B1/1WSne -C0.1 -A0.5 -K -P -Gd2i -S4 -T0.1i/0.03i \
        -U"Example 13 in Cookbook" &gt; $ps
grdcontour dzdy.nc -J -B1/1WSne -C0.05 -A0.2 -O -K -Gd2i -S4 -T0.1i/0.03i -X3.45i &gt;&gt; $ps
grdcontour z.nc -J -B1/1WSne -C0.05 -A0.1 -O -K -Gd2i -S4 -T0.1i/0.03i -X-3.45i -Y3.45i &gt;&gt; $ps
grdcontour z.nc -J -B1/1WSne -C0.05 -O -K -Gd2i -S4 -X3.45i &gt;&gt; $ps
grdvector dzdx.nc dzdy.nc -I0.2 -J -O -K -Q0.03i/0.1i/0.09in0.25i -G0 -S5i &gt;&gt; $ps
echo "3.2 3.6 40 0 6 BC z(x,y) = x * exp(-x@+2@+-y@+2@+)" \
        | pstext -R0/6/0/4.5 -Jx1i -O -X-3.45i &gt;&gt; $ps
rm -f z.nc dzdx.nc dzdy.nc .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_13"></A><A NAME="25156"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>
Display of vector fields in <A NAME="tex2html1386"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A>.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="393" HEIGHT="448" ALIGN="BOTTOM" BORDER="0"
 SRC="img172.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_13}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
<A NAME="24466"></A>

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4532"
  HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4526"
  HREF="node121.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4520"
  HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4528"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4530"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4533"
  HREF="node135.html">7.14 Gridding of data</A>
<B> Up:</B> <A NAME="tex2html4527"
  HREF="node121.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4521"
  HREF="node133.html">7.12 Optimal triangulation of</A>
 &nbsp; <B>  <A NAME="tex2html4529"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4531"
  HREF="node256.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-07-14
</ADDRESS>
</BODY>
</HTML>