September 15 2011

Kurze Nerd Durchsage

Wenn man in gnuplot mehrere Funktionen Plottet, aber jede Funktion nur in einem individuellen Bereich geplottet werden soll, so benutzt man den ternary operator.

Wenn die Funktion f(x) nur im Bereich 100<=x<=300 und die Funktion g(x) nur im Bereich 400<=x<=600 geplottet werden soll, so schreibt man im plotskript:

plot x>=100 && x<=300 ? f(x) : 0/0, x>=400 && x<=600 ? g(x) : 0/0

Funktionsweise:

a?b:c

Als erstes wird a ausgewertet. Im Fall f(x) wäre das die Bedingung x>=100 && x<=300. Wenn das wahr ist wird b ausgeführt, also f(x) geplottet. Falls a unwahr ist wird c ausgeführt, was in diesem Fall 0/0 ist, also nicht definiert ist.

Mehr in gnuplot mit help ternary.

About

Stuff I'd like to share. ♪

loesje

blogs & links

  • Toni
  • Claudi
  • Jule (in .no)
  • Elena
  • potsdamer09
  • Jonathan
  • Steffen
  • Julia
  • ubuntu

    contact

    blog (klammeraffe) icve de

    flattr