# How to generate function from given graph?

Please provide any formula or step by step guide how to generate function for the following graph. Graph logic:

part 1 -> where x <= 3 -> linear relation

part 2 -> when x from 3 to 6 -> y remains unchanged

then again part 1 with 3 < x < 9 - > linear relation

then part 2 when y remains unchanged

Thanks!

EDIT: Values for x,y

x=0 y=0

x=1 y=1

x=2 y=2

x=3 y=3

x=4 y=3

x=5 y=3

x=6 y=3

x=7 y=3

x=8 y=3

x=9 y=3

x=10 y=4

x=11 y=5

x=12 y=6

x=13 y=6

x=14 y=6

and so on..

I am trying to create an interpolator for the following case:

Interpolation time 3500 ms

Value start = 0, end= 1

first 500 ms value increases by the formula (end/3500)*interpolated time

then 1000 ms value remains unchanged

then 500 ms again value increases

then 1000 ms value remains unchanged

then 500 ms again value increases

• What is the value of $f(x) = y$ in the interval $[3, 9]$? You have to construct a piecewise function. Define $f(x)$ on separate intervals of $x$, just like you have verbally done in your question. – JacobCheverie Apr 23 '19 at 15:47
• Do you know how to get the equation of of line if you are given two points on the line? When you ask a question here it helps a lot if you tell us what you have tried and what you know about the question. Otherwise, we don't know where to start with an answer. – saulspatz Apr 23 '19 at 15:48
• @Joshiepillow Thanks, thats was my mistake – Ololoking Apr 23 '19 at 16:01
• @saulspatz I've updated my question with a bit more explanations. Please check it – Ololoking Apr 23 '19 at 16:02
• @JacobCheverie I've updated my question with a bit more explanations. Please check it – Ololoking Apr 23 '19 at 16:03