# How to obtain a random function from defined graph with specified average?

1 view (last 30 days)
Nivedita on 5 Dec 2022
Answered: Gokul Nath S J on 9 Dec 2022
How to plot a random function so that the average of the driving period and the energy loss from graph as shown below will be 3600 seconds and 3 kWh respectively.

Gokul Nath S J on 9 Dec 2022
Dear Nivedita,
I assume, you want the average duration and energy loss of the attached image to be 3600 and 3KWh respectively. As an initial step, one has to find the average of the entire graph and assign the driving time to be 3600. Since the number of intervals are known in the x-axis, one can find the fundamental sampling time.
For example, say you got an average value of the function to be 4000. Then the time corresponding to 4000 in the x-axis will be 3600. Now see in which index does 3600 lies. Say 3600, lies in 500 index of a 100-index array in x-axis. Then one could easily find the interval length and the maximum value of the driving time considering the start value to be zero.
Once the average driving time is set, you can proceed ahead with the energy loss. Say if your equation driving the system is kinetic energy loss and y – axis be velocity. The energy loss will be proportional to square of velocity. Normalize the graph with the energy loss value and multiply the entire graph with 3KWh. This depends on the energy loss function and the quantity in the y-axis.
I hope the above information helps in resolving your issue.
With regards,
Gokul Nath S J