Plotting Weierstrass time series

10 ビュー (過去 30 日間)
Itachi
Itachi 2019 年 8 月 25 日
コメント済み: Star Strider 2019 年 8 月 25 日
Hi, I want to plot the following function. Can anyone help me? Thanks in advance.
gamma = 5, F=1.3, n=30, t=0:0.01:10 (fs = 100Hz, in period of 10 sec = 1000 samples)
Untitled.png
I tried the following code but didn't get this figure!
clc;clear
y=0;
g=5;
F=1.3;
t=0:0.01:10;
for i=1:30
y=y+cos(2*pi*g^i*t)/g^((2-F)*i);
end
plot(t,y)

採用された回答

Star Strider
Star Strider 2019 年 8 月 25 日
There seems to be a scaling variable missing for ‘t’ in the ‘x(t)’ calculation, and your ‘t’ vector does not have fine enough resolution to produce the necessary details in ‘x(t)’.
Use:
t = linspace(0, 1, 1E+5);
and you can avoid the loop entirely with:
[T,I] = ndgrid(t, (1:30));
x = cos(2*pi*g.^I.*T)./g.^((2-F)*I);
xs = sum(x,2);
plot(t, xs)
xlim([0 0.2])
I will let you sort the reason that the plot looks appropriate for (0,0.2) although not on (0,1), the reason I mentioned the ‘scaling variable’.
  2 件のコメント
Itachi
Itachi 2019 年 8 月 25 日
Thanks brother :)
Star Strider
Star Strider 2019 年 8 月 25 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by