Generating chaotic sequence with possitive numbers
1 次查看(过去 30 天)
显示 更早的评论
i want to generate chaotic sequence
without negative numbers
0 个评论
回答(1 个)
Dev
2025-3-26
To generate a chaotic sequence, we can use a logistic map which is a simple mathematical model that exhibits chaotic behaviour. This logistic map can be defined by the equation:
x_n = r * x_n-1 * (1 - x_n-1), where,
‘r’ is a parameter that should be in the range (3.57 to 4) for chaotic behaviour, and
‘x_n’ is the sequence value at step ‘n’.
To ensure the sequence remains non-negative, we can declare ‘x_0’ and define its initial value between 0 and 1. We can then start the sequence (x_1) with this initial value.
Next, we can use the logistic map equation in a ‘for’ loop to generate the entire sequence. For more information regarding the usage of ‘for’ loop, please refer to the documentation below-
I have also attached a reference code snippet below to generate the same-
% Generate the chaotic sequence
n = 100; % configure accordingly
for i = 2:n % starting with 2 since x_1 is already initialized previously
x(i) = r * x(i-1) * (1 - x(i-1));
end
I hope this resolves the issue.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!