I am trying to plot a parametric expression in a gnuplot script which its coefficient are stored in the last row of text file. To do so, firstly I tried this:
plot "<awk 'END{print $1"*cos(t)*cos("$2")-"$3"*sin(t)*sin("$4"), "$1"*cos(t)*sin("$2")+"$3"*sin(t)*cos("$4")"}' manip_file.csv"
but gnuplot says undefined variable: t
. So next I tried the following:
plotCMD = 'awk 'END{print "plot " $1"*cos(t)*cos("$2")-"$3"*sin(t)*sin("$4"), "$1"*cos(t)*sin("$2")+"$3"*sin(t)*cos("$4")"}' manip_file.csv'
eval(plotCMD)
But this time gnuplot says ';' expected
. If I run the awk
command in the command line it gives me a correct equation which gnuplot has not problem plotting it. Hence it is not a problem of missing some single/double quotations. Trying to escape the dollar signs (\$1
) didn't solve the problem as well. Any thoughts?