zwerg4 zwerg4 - 3 months ago 31
LaTeX Question

Latex Plot wrong Graph

You guys have an idea why latex plots the wrong function?

This is my function:

\draw [scale=0.5,domain=-3:3,smooth,variable=\x] plot (\x,0.5*\x^4 - 3*\x^2+ 4) node[right] {$f(x)=0.5*x^4 - 3*x^2 + 4$};

and this is the result:
Latex Graph

But is should look like this:
Right Graph

Thank you

Answer Source

In tikz, parentheses are required to properly square negative numbers.

\draw [scale=0.5,domain=-3:3,smooth,variable=\x] plot (\x,{0.5*(\x)^4 - 3*(\x)^2+ 4}) node[right] {$f(x)=0.5*x^4 - 3*x^2 + 4$};

This should produce what you wanted.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download