Skip to main content

Thread: How to increment a column in AWK


hi,

want make graph of karplus function

f($1) = 15.3*(cos((180/$pi)*$1+120))**2-6.2*cos((180/$pi)*$1+120)+1.5

want make text file awk, learning experience away libre office.

want like

0 f(0)
1 f(1)
2 f(2)
3 f(3)

etc. can graph grace. i've found numerous reference working from file never creating 1 awk.

thought of (pca perl math script, , doesn't work)
code:
awk 'begin {t=0} {print $1, pca '15.3*(cos((180/3.14)*$1+120))**2-6.2*cos((180/3.14)*$1+120)+1.5', t++}'
but can't find information how far take incrementation.

appreciated!
-dave

use for-loop in begin block.
code:
awk ' begin {   (t=0;t<100;t++) {     print t, 15.3*...;   } }'
what you're doing doing calculation of first field of each line of input, doesn't sound want that.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] How to increment a column in AWK


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support