3

I have a function with a parameter z similar to the above one:

y = sin(x+z)

How can I plot the values of y as a function of x and all the possible values of z in the [0.1, +0.1]?

I want to graphic the area defined by those limits. So everything bounded by sin(x-0.1) and sin(x+0.1) would be shaded, everything outside would be white space.

I'm trying to accomplish this with gnuplot, but with any software would probably be fine.

1
  • Maybe something like plot '+' using ($1):(sin($1+.1)):(sin($1-.1)) w filledcurves
    – Hastur
    Jul 5, 2016 at 16:00

2 Answers 2

2

You can try to use the pseudofile + and plot with the filledcurves option:

set termoption enhanced
set style fill transparent solid 0.70 noborder
set key off
set sample 1000
set xlabel "{/*1.2x}" 
set ylabel "{/*1.2f(x)}"
plot [0:2*pi] '+' using ($1):(sin($1+.1)):(sin($1-.1))  w filledcurves

enter image description here

2
  • That's the case {sin(x-0.1) < y < sin(x+0.1)} U {sin(x-0.1) > y > sin(x+0.1)}. It's not sure what the OP wanted anyway.
    – Joce
    Jul 5, 2016 at 16:38
  • After 5-6 year I'm not sure that even the OP know it :D I try to take an hint when the OP states "So everything bounded by sin(x-0.1) and sin(x+0.1) would be shaded, everything outside would be whitespace"
    – Hastur
    Jul 5, 2016 at 16:42
1

Have a look at filledcurves.

To plot the set {sin(x-0.1) < y < sin(x+0.1)}, use:

unset key
set sample 1000
plot sin(x+0.1) w filledcurves y=-1 lw 0
replot sin(x-0.1) w filledcurves y=-1 lc rgbcolor "white" lw 0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .