File:Piecewise linear function gnuplot.svg

From Department of Mathematics at UTSA
Jump to navigation Jump to search

Original file(SVG file, nominally 802 × 603 pixels, file size: 71 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Plot of the piecewise linear function
Date
Source Own work
Author Jochen Burghardt
Other versions File:PiecewiseLinear.png * File:Piecewise linear function.svg * File:Piecewise linear function gnuplot.svg
Gnuplot source code
set xrange [-5:5]
set yrange [-3:3]
set xtics 1
set ytics 1

f(x) =  (            x <= -3    ? -3 - x        \   
        : -3 <= x && x <=  0    ? x + 3         \   
        :  0 <= x && x <=  3    ? 3 - 2*x       \   
        :                         0.5*x - 4.5   \   
        )

set grid

# y axis
set arrow from 0,-3 to 0,3 nohead lt 8

#x axis
  plot           0    with lines lt 8 lw 1 title ""

# plot the function
#replot           f(x) with lines lt 6 lw 3 title ""

# plot the function in pieces to avoid artifacts at interval boundaries
replot [x=-5:-3] f(x) with lines lt 6 lw 3 title ""
replot [x=-3: 0] f(x) with lines lt 6 lw 3 title ""
replot [x= 0: 3] f(x) with lines lt 6 lw 3 title ""
replot [x= 3: 5] f(x) with lines lt 6 lw 3 title ""
pause -1

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

30 September 2020

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current06:22, 30 September 2020Thumbnail for version as of 06:22, 30 September 2020802 × 603 (71 KB)Jochen BurghardtUploaded own work with UploadWizard

The following page uses this file:

Metadata