Prompt the function to generate a random smooth curve (for example, as in the picture).
Or an algorithm for constructing such a function F(t) , where t is a dynamic parameter
3 answers
Throw a few equidistant random points on the plane. The x coordinate of which will constantly increase by step h, and the height will be a random number. Decide how. After this, approximate this set of points using cubic splines for example.
- And if the total number of points is not known in advance? And the schedule should be built "in real time"? Just expected to answer exactly the function with dynamic parameters - ThisMan
- 2Well, and build a graph in real time. And as you get to the last point, generate another random - and build on. Well, or draw a "turtle", plus a random change in the direction of movement (with an uneven probability of choosing a direction, so as not to roam around) - also nothing. - Akina
- At the moment, the only option that does not lead to y = f (x). - Qwertiy ♦
- @Qwertiy, but it does, albeit in some way answers the question in the wrong way - ThisMan
- @ThisMan, actually, on the contrary, I had in mind that this is the only option that answers as it should. In the question
(x,y)=f(t), and for ally=f(x) & x=g(t):) - Qwertiy ♦
Take, so to speak, the trend :) what exactly you need - growing, decreasing, fluctuating around zero - and at each small step of solving the corresponding differential equation with the same simplest Euler add random deviations. Does this come down? Here is such a spoiled sinusoid:
And here is the corresponding code:
int main(int argc, const char * argv[]) { default_random_engine u; normal_distribution<double> rnd(0.0,0.1); double y = 0.0; double h = 0.1; for(double x = 0.0; x < 10.0; x += h) { y += cos(x)*h + rnd(u); cout << "{" << x << "," << y << "},\n"; } } (I have the data for Wolfram Mathematica). Smoothness and so on - selected by parameters ...
I would experiment with polynomials. Would control ratios in a certain way. The dependence of the coefficients already depends specifically on your task (what restrictions should be imposed)
- oneOn the one hand, it does not pull the answer, on the other hand, the top-starter asks for the algorithm ... well, it looks fine. - AK ♦
- @AK, yes, I agree. If the author would give more specific restrictions on the function, I would specify the answer - LmTinyToon

