0

I would like to plot a function f: R -> R^2 like f(t) = (cos(t), sin(t)), but I don't see how to do it.

f(t) = (cos(t), sin(t))
plot f(x) # doesn't work
splot f(x) # doesn't work either and is probably not what I want

Is there a way to plot such a function in gnuplot?

1 Answer 1

2

Please check help parametric, help special-filenames, help sampling and this: http://gnuplot.sourceforge.net/demo_5.4/param.html.

Here are two approaches:

Script:

### parametric curves
reset session

fx(t) = cos(t)
fy(t) = sin(t)

set size ratio -1
set xrange[-1.1:1.1]
set yrange[-1.1:1.1]

set multiplot layout 1,2
    set parametric
    plot [t=0:2*pi] fx(t), fy(t) w l lc "red"
    unset parametric

    plot sample [t=0:2*pi] '+' u (fx(t)):(fy(t)) w l lc "blue"
unset multiplot
### end of script

Result:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.