First of all, I apologize for my lack of proper math vocabulary. I'm mainly a programmer.
I need to write an equation that relates variables s and p. (s is
star mass, p is planet radius). The equation needs to roughly fit these parameters:
When s = 2, changing p between 0.01 and 2 makes the output range from 340 to 350.
When s = 1, changing p makes the output range from 0 to 150.
When s = 0.5, changing p makes the output range from 0 to 50.
s is limited to the range 0.5 to 2, and p is limited to 0.01 to 2.
Here's a visual representation of what I'm talking about:
--
How do I go about solving something like this? I've been doing trial and error for a little too long, so I figured I'd open up a question on here.
What I have so far is something like:
$f(s, p) = (30 + (s * 4)^2) * (p * 4)$
But it's not quite right.
For some context, what I'm doing is putting together an equation to output the width of the planet orbit line in this simulation, when the planet radius and star mass variables are altered: https://cse.unl.edu/~astrodev/flashdev2/transitSimulator/transitSimulator017.html (requires Flash)

Your picture suggests that for each value of $s$ the function can be linear in $p$. So what you want to start with is two functions $L(s)$ and $H(s)$ (for "low" and "high") that give the correct values for $f$ when $p=0.01$ and $p=2$ respectively. Suppose you have those functions (we'll get to that later). Then for each $p$ you want to interpolate linearly between $L$ and $H$ to get $f$. So your formula is $$ f(s,p) = \frac{2-p}{2 - 0.01} L(s) + \frac{p-0.01}{2 - 0.01} H(s). $$ (You can simplify that formula a lot, but I wrote it that way so you can see the linear interpolation.)
Now what should $L$ and $H$ be? I think you have to do that with cases
$$ L(s) = \begin{cases} 0 & 0.01 \le s \le 0.5 \\ \frac{s-0.5}{2-0.5} \times 340 & 0.5 \le s \le 2 \end{cases} . $$
That should be enough examples of linear interpolation for you to write the cases for $H$.