Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 5764c67416561ab82b35afcf9c650e17 > files > 576

GMT-doc-4.5.2-1.fc13.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.30 Trigonometric functions plotted in graph mode</TITLE>
<META NAME="description" CONTENT="7.30 Trigonometric functions plotted in graph mode">
<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="previous" HREF="node149.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node151.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4720"
  HREF="node151.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4714"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4710"
  HREF="node149.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4716"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4718"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4721"
  HREF="node151.html">8. Creating GMT Animations</A>
<B> Up:</B> <A NAME="tex2html4715"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4711"
  HREF="node149.html">7.29 Gridding spherical surface</A>
 &nbsp; <B>  <A NAME="tex2html4717"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4719"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015300000000000000000"></A>
<A NAME="24170"></A>
<BR>
7.30 Trigonometric functions plotted in graph mode
</H1>

<P>
Finally, we end with a simple mathematical illustration of sine and cosine, highlighting the
it graph mode for linear projections and the new curved vectors for angles.

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 30
#
# Purpose:      Show graph mode and math angles
# GMT progs:    gmtmath, psbasemap, pstext and psxy
# Unix progs:   echo, rm
#
# Draw generic x-y axes with arrows
ps=example_30.ps

psbasemap -R0/360/-1.25/1.75 -JX8i/6i -B90f30:,-\\312:/1g10:."Two Trigonometric Functions":WS -K \
        -U"Example 30 in Cookbook" --BASEMAP_TYPE=graph --VECTOR_SHAPE=0.5 &gt; $ps

# Draw sine an cosine curves

gmtmath -T0/360/0.1 T COSD = | psxy -R -J -O -K -W2p &gt;&gt; $ps
gmtmath -T0/360/0.1 T SIND = | psxy -R -J -O -K -W2p,. --PS_LINE_CAP=round &gt;&gt; $ps

# Indicate the x-angle = 120 degrees
psxy -R -J -O -K -W0.5p,- &lt;&lt; EOF &gt;&gt; $ps
120     -1.25
120     1.25
EOF

pstext -R -J -O -K -Dj0.05i -N &lt;&lt; EOF &gt;&gt; $ps
360 1 18 0 4 RB x = cos(@%12%a@%%)
360 0 18 0 4 RB y = sin(@%12%a@%%)
120 -1.25 14 0 4 LB 120\\312
370 -1.35 24 0 12 LT a
-5 1.85 24 0 4 RT x,y
EOF

# Draw a circle and indicate the 0-70 degree angle

echo 0 0 | psxy -R-1/1/-1/1 -Jx1.5i -O -K -X3.625i -Y2.75i -Sc2i -W1p -N &gt;&gt; $ps
psxy -R -J -O -K -m -W1p &lt;&lt; EOF &gt;&gt; $ps
&gt; x-gridline  -W0.25p
-1      0
1       0
&gt; y-gridline  -W0.25p
0       -1
0       1
&gt; angle = 0
0       0
1       0
&gt; angle = 120
0       0
-0.5    0.866025
&gt; x-projection -W2p
-0.3333 0
0       0
&gt; y-projection -W2p
-0.3333 0.57735
-0.3333 0
EOF

pstext -R -J -O -K -Dj0.05i &lt;&lt; EOF &gt;&gt; $ps
-0.16666 0 12 0 4 CT x
-0.3333 0.2888675 12 0 4 RM y
0.22 0.27 12 -30 12 CB a
-0.33333 0.6 12 30 4 LB 120\\312
EOF

echo 0 0 0 120 | psxy -R -J -O -Sml1i -W1p &gt;&gt; $ps

rm -f .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<P>
The script simply draws a graph basemap, computes sine and cosine and plots them as lines, then
indicates on a circle that these quantities are simply the projections of an unit vector on the
x- and y-axis, at the given angle.

<P>

<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_30"></A><A NAME="25155"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.30:</STRONG>
Trigonometric functions plotted in graph mode.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="528" HEIGHT="401" ALIGN="BOTTOM" BORDER="0"
 SRC="img208.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_30}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
<A NAME="24175"></A>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4720"
  HREF="node151.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4714"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4710"
  HREF="node149.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4716"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4718"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4721"
  HREF="node151.html">8. Creating GMT Animations</A>
<B> Up:</B> <A NAME="tex2html4715"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4711"
  HREF="node149.html">7.29 Gridding spherical surface</A>
 &nbsp; <B>  <A NAME="tex2html4717"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4719"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>