Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^7: Make sin wave with GD

by sn1987a (Chaplain)
on Jul 01, 2015 at 18:56 UTC ( #1132880=note: print w/replies, xml ) Need Help??

in reply to Re^6: Make sin wave with GD
in thread Make sin wave with GD

I'm not sure I understand what you are asking, but I will take a shot. If f(x) is a function whose range goes from $f_min to $f_max over the domain of interest, and the graph is of size $graph_size, then plot

my $span = $f_max - $f_min; $y = (-f($x)-$f_min)*$graph_size/$span;

In the case of your sine, you would have $f_min = -1; $f_max = 1; $graph_size = 400. This simplifies the the expression in my previous response.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1132880]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2019-04-21 14:05 GMT
Find Nodes?
    Voting Booth?
    I am most likely to install a new module from CPAN if:

    Results (111 votes). Check out past polls.