基于斐波那契比率的阻尼正弦波

Damped sine wave based on Fibonacci ratio

如何根据斐波那契比率制作阻尼/阻尼正弦波?

我可以使用 Octave/Matlab 创建基于斐波那契比率的绘图,请参阅下面的代码和绘图。

clear all,clf reset, clc,tic
more off

fib1=[1,1,2,3,5,8,13,21]
fib2=[1,2,3,5,8,13,21,34]
y=fib1./fib2
x_end=size(fib1,2);
x=[1:x_end]
plot(x,y)

我试图让情节看起来像阻尼正弦波,但基于斐波那契比率。请参阅示例阻尼图。

Ps:我正在使用 Octave 4.0,它类似于 Matalb

我想我明白你在找什么。基本上,这个问题背后的主要概念是从斐波那契数列中提取的连续数字的比率可以近似于 golden number (also known as phi) and that the higher you climb into the sequence, the closer phi can be approximated. Starting from this assumption, you want to show that the way these ratios relate to phi follows the pattern defined by a damped sine wave.


您绘图的主要问题是用于绘图的点太少,因此生成的线看起来是分段的,而不是显示典型的正弦形状。此外,被一个 (fib2) 偏移的序列应该是一个被另一个 (fib1) 除以另一个 (fib1),而不是相反......只要我没有误解你的目标。

给定包含足够点的范围 x = 0:0.01:9 以允许以正确的形状绘制线,让我们从构建和绘制波本身开始:

x_max = 9;
x = 0:0.01:x_max;

gr = (1 + sqrt(5)) / 2;
w = (gr - 2) .* exp(1 - x) .* cos(pi() .* x) + gr;
plot(x,w);

seq = 1:(x_max+2);
fib = fibonacci(seq);
p = fib(2:end) ./ fib(1:end-1);

y = NaN(size(x));
y(ismember(x,seq-1)) = p;

hold on;
plot(x,y,'or');
hold off;

最终输出:


如果您的唯一目标是绘制您计算的波浪...正如我之前所说,主要问题是缺少点。只有 8 个点,由于精度不佳,线条失去了形状。为了解决它,请按如下方式编写代码(spline,正如 Cris 所建议的,在这种情况下是一个非常好的工具):

fib1 = [1,1,2,3,5,8,13,21];
fib2 = [1,2,3,5,8,13,21,34];
y = fib1 ./ fib2;
y = spline(0:7,y,0:0.01:7);

plot(y);