[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two Superposed Plots
From: |
Martin Senator |
Subject: |
Re: Two Superposed Plots |
Date: |
Mon, 26 Jun 2006 16:24:43 -0400 (EDT) |
Thanks to everyone who helped.
This file is to document a solution
that worked.
1 + echo on;
2 +
3 + # Just issued the commands
4 + # > page_screen_output=0; > diary on; and > echo on;
5 + # file superpose.m ;
6 + # purpose: to show how to superpose two plots in Octave.
7 +
8 +
9 + omega = linspace (0, 2.5, 501) ;
10 + a = 1./sqrt( (-omega.^2 + 1 ).^2 + (0.64*omega).^2 ) ;
11 + mat1 = [omega' a' ] ;
12 +
13 + th_circ = linspace ( 0, 2*pi, 361 ) ;
14 + x_circ = cos ( th_circ ) + 0.4 ;
15 + y_circ = sin ( th_circ ) ;
16 + mat_circ = [x_circ', y_circ'] ;
17 +
18 + titlestr = "Illustrating Superposition of Two Plots" ;
19 + xlabelstr = "Forcing Frequency, {/Symbol w}" ;
20 + ylabelstr = "Amplitude, a"
21 ylabelstr = Amplitude, a
22 +
23 + __gnuplot_set__ terminal postscript portrait enhanced color
24 + __gnuplot_set__ output 'plotsup.ps'
25 + __gnuplot_set__ nokey ;
26 + __gnuplot_set__ timestamp bottom ;
27 +
28 + __gnuplot_set__ xtics nomirror ;
29 + __gnuplot_set__ ytics nomirror ;
30 + __gnuplot_set__ xtics ;
31 + __gnuplot_set__ ytics ;
32 + __gnuplot_set__ x2tics ;
33 + __gnuplot_set__ y2tics ;
34 + __gnuplot_set__ xrange [0:2.5] ;
35 + __gnuplot_set__ yrange [0:1.8] ;
36 + __gnuplot_set__ x2range [-3:1.5] ;
37 + __gnuplot_set__ y2range [-3.0:1.5] ;
38 + __gnuplot_set__ size square ;
39 + #
40 + __gnuplot_plot__ mat1(:,1:2) axes x1y1\
41 + ,mat_circ(:,1:2) axes x2y2 ;
42 + #
43 + xlabel ( xlabelstr ) ;
44 + ylabel ( ylabelstr ) ;
45 + title ( titlestr ) ;
46 + __gnuplot_set__ x2label "Displacement" ;
47 + __gnuplot_set__ y2label "Velocity" ;
48 + #
49 + system('rm plotsup.ps');
50 + __gnuplot_set__ output 'plotsup.ps'
51 + replot
52 + closeplot
53 +
54
55 + diary off;
ms
- Re: Two Superposed Plots,
Martin Senator <=