How the envelope detector works?
If the input voltage is less than the output voltage, the output is an exponentially decaying voltage governed by R and C i.e.

\$V_{out}=V_xe^{\frac{-t}{RC}}\$ 

\$V_x\$ is the voltage when the input voltage became less than the output voltage

At all other times the output voltage equals the input voltage. There is no linear equation (that I'm aware of) that satisfies this particular circuit.