We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've been searching a lot for this. I can't wrap my head about how to do it.
I need to graph it via y=mx + b. I'm quite new programming this kind of stuff.
Any guidance will be appreciated.
Thanks!
Answers
what's the range for x?
because a for loop is a good way of iterating over all the values in a range...
that's the simplest thing; use a for loop with
x
then say
y=7*x + 6;
and thenpoint(x,y);
@dawnspectraa -- note that if it is a linear equation specifically, you don't actually need to loop over points and plot each point. You just need to solve for two points and then pass them to
line()
.Solve x for the minimum and maximum y (or vice versa). Here is an example, which includes flipping the origin:
If you want a nice graph (axis, labels etc.), without having to program it all yourself, try installing grafica.
There is also a method in grafica to draw these simple lines: plot.drawLine(slope, yCut)