1

I am plotting in 2D on gnuplot through Ubuntu. When defining my equation for 'radius of curvature' a function of theta=x of variables sin and cos functions, respectively, I get an error message saying 'undefined variable: sin' or cos. I am simply defining the variable R=1 in the equation then setting

f(x) = R*sin(x)*(1+4*cos**2*(x)**(1.5)) / 2*(2*sin**2*(x)+3*cos**2*(x))

then saying plot f(x). What am I doing wrong?

1
  • gnuplot does not recognize cos**2(x) as meaning cos(x)**2. It thinks you are squaring a variable named cos. Commented Aug 8, 2022 at 5:52

1 Answer 1

0

With your function

f(x) = R*sin(x)*(1+4*cos**2*(x)**(1.5)) / 2*(2*sin**2*(x)+3*cos**2*(x))

you should actually get an error undefined variable: cos,

Your intention probably was:

f(x) = R*sin(x)*(1+4*cos(x)**2**(1.5)) / 2*(2*sin(x)**2 + 3*cos(x)**2)

or maybe

f(x) = R*sin(x)*(1+4*cos(x)**2**(1.5)) / (2*(2*sin(x)**2 + 3*cos(x)**2))

where I'm not sure whether in the first part this should really be: cos(x)**2**1.5

or maybe: R*sin(x)*(1+4*cos(x)**2)**1.5

Mind the parentheses.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this is what worked. I realized that the value of the power comes immediately after. Thankyou

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.