MATLAB Answers

0

How to use hanning window to get 5 cyles of sine waves?

Kaleesh Bala さんによって質問されました 2019 年 8 月 12 日
最新アクティビティ Kaleesh Bala さんによって コメントされました 2019 年 8 月 12 日
load ( 'x.mat' )
t = 0: 10 * pi; % 5 cyeles
sf = 200e3; % frequency
sinewave = sin (2 * pi * sf * x); % gen continuous sine waves
w = hanning (length (sinewave)); % hann
figure (1);
plot (w);
% I do not know where to include the 5 cycles here

  0 件のコメント

サインイン to comment.

タグ

製品

1 件の回答

回答者: Andrey Kiselnikov 2019 年 8 月 12 日
編集済み: Andrey Kiselnikov 2019 年 8 月 12 日
 採用された回答

First of all you should properly define your data: "t = 0: 10 * pi; % 5 cyeles" I assume that you would like to define something like this "t = 0:1/sf:10*pi", more over "t" never used. Can you describe your task more properly?
>> t = 0: 10 * pi
t =
Columns 1 through 17
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Columns 18 through 32
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

  12 件のコメント

Kaleesh Bala 2019 年 8 月 12 日
What I meant was the sine wave looks similar,will that be in modulated state as the time increases
f = 200*10^3; % sine frequency[Hz]
sf = 10*10^6; % sampling frequency [Hz]
n = 5; % number of sine periods [-]
T = 1/f; % sine period [s]
tt = n*T; % total time [s]
t = 0:1/sf:tt; % time vector
burst = sin(2*pi*f*t) .* hanning(size(t,2))';
plot(t,burst);
In this example the sine waves starts with 0,then increases and then decreases - a modulate signal.
How can i make the same with the 'x' time vector?
Kaleesh Bala 2019 年 8 月 12 日
this gives me a modulated signal (increasing-decreasing)
f = 200*10^3; % sine frequency[Hz]
n = 5; % number of sine periods [-]
T = 1/f; % sine period [s]
tt = n*T; % total time [s]
burst = sin(2*pi*f*x) .* hanning(size(x,2))';
plot(x,burst);
but it's not correct as it should be only for 5 signals and then rest of the vecot should be '0'( a flat signal)
sine.PNG
Kaleesh Bala 2019 年 8 月 12 日
So,how to make it to start as modulated signal and then after 5 cycles to be flat signal =0

サインイン to comment.



Translated by