Gnuplot: getting functions to talk to titles and saveing parameters to a file.

In summary, gnuplot can label your line with the equation and parameters using the set label command and save the parameters to a file using the set print command for future reference.
  • #1
Pha07psm
1
0
Hi. I am doing a PhD atm and I have decided to take the plunge with gnuplot. I have fitted some data to an equation h(t)=ho+a(t-to)^b+kt, with a, to, b and k being fitting constants (empirical formulae describing creep behaviour of a compressed material with time).

Does anybody know how I can:

1) make these constants come up so the specific equation comes up in the text describing the line?

2) make gnuplot save these constants in a dat or csv or whatever for future reference?


Any help would be massively appreciated!
 
Physics news on Phys.org
  • #2
Thanks!For 1), you can use the set label command in gnuplot to label your line with the equation and parameters. For example, if your equation is h(t)=ho+a(t-to)^b+kt, you can add the following label to the plot: set label "h(t)=ho+a(t-to)^b+kt, a=%g, to=%g, b=%g, k=%g" at graph 0.5, 0.9 This will make the label show up on your graph with the appropriate parameters substituted in. For 2), you can use the set print command in gnuplot to save the parameters to a file. For example, if you want to save the parameters to a file called "parameters.dat", you can use the command: set print "parameters.dat" print a, to, b, k This will save the parameters to the file in comma-separated values.
 

1. How do I get a function to appear in the title of my Gnuplot plot?

To get a function to appear in the title of your Gnuplot plot, you can use the "title" command followed by the function you want to display. For example, if you have a function called "f(x)" and want it to appear in the title, you can use the command "title 'f(x)'. This will display the function name in the title of your plot.

2. Can I save parameters from my Gnuplot plot to a file?

Yes, you can save parameters from your Gnuplot plot to a file by using the "set print" command. This command allows you to specify the file name and format, and then all the parameters will be printed to that file. You can then use this file for further analysis or to save the parameters for later use.

3. How do I assign a variable to a function in Gnuplot?

To assign a variable to a function in Gnuplot, you can use the "set" command followed by the variable name, an equal sign, and the function. For example, if you want to assign the variable "x" to the function "sin(x)", you can use the command "set x = sin(x)". This will allow you to use the variable in your plot and also in the title or other commands.

4. Is it possible to use multiple functions in the title of a Gnuplot plot?

Yes, it is possible to use multiple functions in the title of a Gnuplot plot. You can use the "title" command followed by a string of functions separated by commas. For example, if you want to display the functions "f(x)" and "g(x)" in the title, you can use the command "title 'f(x), g(x)'. This will display both functions in the title of your plot.

5. How can I customize the appearance of the title in my Gnuplot plot?

To customize the appearance of the title in your Gnuplot plot, you can use the "set title" command followed by various options. Some of the options you can use are font, color, size, and position. For example, if you want to change the font of the title to bold and make it red, you can use the command "set title 'My Title' font 'bold' textcolor 'red'". This will change the appearance of the title in your plot according to your specifications.

Similar threads

  • Atomic and Condensed Matter
Replies
3
Views
863
  • Programming and Computer Science
Replies
4
Views
4K
Back
Top