How to find an equation through graph?

46 Views Asked by At

I did some beam forming simulations in Matlab and after all the calculations I end up in a graph that looks like the attached image. Now I want to find an equation that fits this graph. For example I know the vector x=[1:1:20] and I need to find the values of y=[7 7 7 7 7 7 7 7 9 9 9 12 12 12 10 10 10 10 10 10] through some equation. It looks like a stair case function that resembles somewhat to a Gaussian curve but I couldn't find any equation for discrete Gaussian. Can you kindly guide me what is the best possible way to find an equation that fits this curve? enter image description here

1

There are 1 best solutions below

5
On BEST ANSWER

Use a combination of step and ramp functions to make up your graph. They are defined as follows:

Step: $$ h(t-\tau) = \begin{cases} A, \hspace{10pt} t\ge \tau, \\ 0, \hspace{10pt} t<\tau \end{cases} $$ Ramp: $$ r(t) = C\cdot t\cdot h(t-\tau)$$ where $A$ is the final value of the step function, $\tau$ the point at which the function changes its value from $0$ to the corresponding value and $C$ is the slope of the ramp. You can use a combination of these functions by choosing the appropriate values of $\tau$, $A$ and $C$. The solution using combinations for your function is: $$ f(t) = 7h(t)+2th(t-8)-2th(t-9)+3th(t-11)-3th(t-12)-2th(t-14)+2th(t-15) $$ enter image description here

If you want a single function that mimics your data then Fourier series is the right approach. The figure below is the Fourier approximation of your data for 8 terms in the series but as the number of terms is larger so is the approximation better. enter image description here