0
votes

Does anyone know if the splot command can be used to generate impulses in the x-y plane?

For example, I have the following segment of gnuplot code;

splot \
\
u, 0,       cos(u) linecolor "red"     notitle with impulses, \
u, sin(u),  0      linecolor "blue"    notitle with impulses, \
u, sin(u),  cos(u) linecolor "green"   notitle

The first (red) plot successfully generates impulses in the x-z plane, i.e. vertically oriented impulses. The second (blue) plot however, does not generate impulses in the x-y plane, i.e. horizontally oriented impulses, as I would like! Does anyone know how to accomplish this? Furthermore, does anyone know if it possible to use any of the gnuplot iteration commands to do this? Ideally, I would like to have impulses - or something similar like arrows, from the x-axis to the third (green) plot as well.

Thanks in advance.

2
Running your code results in undefined variable: u. - Roland Smith
@RolandSmith well, you need to set parametric - ewcz

2 Answers

1
votes

The blue graph is plotted, but not like you expect. Try changing the 0 to e.g. 0.1:

Example plot

The reason for this is that in 3D plots, the impulses style always plots lines from z=0 to the actual z value.

What you want is not possible with impulses.

You might be able to adapt this filledcurves example from gnuplotting.org.

0
votes

The following image was generated with gnuplot. The green lines radiating outward from the x-axis (Theta axis in the image) were implemented using arrows without heads.

3D visual representation of Euler's formula.

I could have simulated impulses for the blue plot using this same approach of arrows without heads, but I have omitted it from the image in order to assist with visual clarity. So, while it appears that impulses can't be used in any orientation other than vertically, arrows can be used for the same effect!

Although this image provides a good visual representation of Euler's formula, I think an even better one is achieved with a 3D "fly-around" of the plot as Theta increases.

3D "fly-around" of Euler's formula.

The gnuplot code which I used to implement the green arrows, was as such;

set \
\
for [x_new = 0:max_plot_index] \
\
arrow from (x_new * plot_inc),0,0 to (x_new * plot_inc),sin(x_new * plot_inc),cos(x_new * plot_inc) linecolor "green" nohead

where max_plot_index was increased by 1 for every frame of the "fly-around" animation and plot_inc was set to (4 * pi)/100.

I hope someone finds this helpful!