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?

- 374,822
- 3
-
Where is the attachment image ?? – IrbidMath Oct 24 '19 at 13:34
-
There is a small reference 1 at the end of my question, highlighted in blue (1). Can you kindly click on that to see the image? – Sadaf Oct 24 '19 at 14:43
-
What is the purpose of having one equation for the graph? You have an array with the values. If you want $f(8.5)$ you can just look up $f(8)$ and $f(9)$, then linearly interpolate between them. Really that is what an equation of step and ramp functions will give you. – Ross Millikan Oct 24 '19 at 15:35
1 Answers
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) $$
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.
- 753
-
Thank you for the answer. I will try to solve through step and ramp function as well. Actually I am more interested in an equation that is continuous (dont want to define any intervals like step function) because this is just one result of y. If I change my beamforming parameters I might get another curve in a similar shape but different intervals. So, in real I dont know these intervals. – Sadaf Oct 24 '19 at 14:42
-
In the way you drew it the function is not continuous and thus you can use the step and ramp. On the other hand, if you want to smoothen out the curve and get a continuous function the look will change. In this procedure, you can use Fourier analysis and get an infinite sum which perfectly represents your function over one period. But I think I can find out a polynomial type function that reassembles your function but it will be smoothen out a little bit. – Dinno Koluh Oct 24 '19 at 14:54
-
@DinnoKoluh : the ramp functions are continuous, thought their derivatives are not. Since you have data at discrete points, you can't tell a step from a steep ramp. – Ross Millikan Oct 24 '19 at 15:36
-
Yes, I agree about the continuity. Yeah, a steep ramp would mimic a step, actually, a ramp with an infinite slope would represent a step. – Dinno Koluh Oct 24 '19 at 15:38
-
Thank you for the elaborated graphs. I think the Fourier analysis gives a better look to the function. I will look into it. Many thanks. – Sadaf Oct 25 '19 at 07:24
