How do i create a dataset which has a sine wave which is swept a hz to b hz within the time t.

回答 (1 件)

Image Analyst
Image Analyst 2015 年 5 月 21 日

1 投票

If you have the Signal Processing Toolbox look in the help for chirp():
chirp
Swept-frequency cosine
Syntax
y = chirp(t,f0,t1,f1)
y = chirp(t,f0,t1,f1,'method')
y = chirp(t,f0,t1,f1,'method',phi)
y = chirp(t,f0,t1,f1,'quadratic',phi,'shape')

8 件のコメント

James
James 2015 年 5 月 21 日
could you give an example ?
James
James 2015 年 5 月 21 日
it doesn't provide a dataset
Image Analyst
Image Analyst 2015 年 5 月 21 日
Did you try to adapt the example in the help:
a = 1
b = 150;
t = linspace(0, 0.1, 300);
y = chirp(t, a, t(end), b);
plot(t, y, 'b*-');
grid on;
Mahmoud Khadijeh
Mahmoud Khadijeh 2022 年 4 月 29 日
I have question please,
The amplitude is equal to 1 when the time = 0.
Can we modify this code so the amplitude starts with 0 at t=0?
Thanks in advance!
Image Analyst
Image Analyst 2022 年 4 月 29 日
編集済み: Image Analyst 2022 年 4 月 29 日
@Mahmoud Khadijeh did you try just subtracting it from 1?
a = 1
a = 1
b = 150;
t = linspace(0, 0.1, 300);
y = 1 - chirp(t, a, t(end), b);
plot(t, y, 'b*-');
grid on;
Otherwise you could make up your own with a vector for frequency, and use
y = sin(2 * pi * frequency .* t)
Mahmoud Khadijeh
Mahmoud Khadijeh 2022 年 4 月 29 日
Yes, subtracting it from 1 will change the entire amplitudes.. As you can see in last figures that the amplitudes are equal to 2 not 1 like the first figure.
Mahmoud Khadijeh
Mahmoud Khadijeh 2022 年 4 月 29 日
Can you pleaes help me with this code if you have the experience to do it?
This is the Logarithmic Sweep Rate equation that I am trying to implement:
The starting and ending frequencies are f1 and f2 , respectively.
The sweep rate in octaves per time is R
Thank you in advance!
Image Analyst
Image Analyst 2022 年 4 月 29 日
f1 =
f2 =
R =
t = linspace(0, 5*pi, 2000);
frequency = linspace(f1, f2, length(t));
y = sin(2 * pi * frequency .* (-1 + 2.^(R * t)) / (R*log(2)));

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

質問済み:

2015 年 5 月 21 日

コメント済み:

2022 年 4 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by