Using obw to solve for the bandwidth of a signal

27 ビュー (過去 30 日間)
Russell Geschrey
Russell Geschrey 2021 年 9 月 17 日
コメント済み: Russell Geschrey 2021 年 9 月 24 日
Hello everyone,
I have a bunch of symbols in the time domain and I am trying to do the fft of them and then calculate their bandwith. I have been trying to use the obw function to do this but the values do not seem to be right. My code is below:
clear
Fs = 1000;
Ts= 1/Fs;
symbol_duration= 1;
t= 0:Ts:symbol_duration;
%% number of functions is degree. Only one for testing
degree = 1;
p(1,:) = (2/symbol_duration)*cos(2*pi*15*t) + (2/symbol_duration)*cos(2*pi*50*t);
for i = 1:degree
%%%%% https://www.mathworks.com/help/matlab/math/fourier-transforms.html
xform=(1/Fs) .* fft( p(i,:) );
n=length(p(i,:));
fshift = (-n/2:n/2-1)*(Fs/n);
yshift(i,:) = abs( fftshift(xform) );
bw(i)= obw( yshift(i,:) )
plot(fshift,yshift(i,:))
xlim([0 Fs/2])
hold on
end
bw = 3.0991
The plot of my fft appears to be correct, but bw always seems to be some very small number that seems incorrect. Any help would be appreciated!

採用された回答

Ashutosh Singh Baghel
Ashutosh Singh Baghel 2021 年 9 月 24 日
編集済み: Ashutosh Singh Baghel 2021 年 9 月 24 日
Hi Russell,
I understand that 'obw' function is used for returning the 99% occupied bandwidth of the input signal. The function 'obw' uses input signal instead of 'fft' of that input signal. Also, it is good practise to give sampling frequency 'Fs' as second input to 'obw' function.
Please try in the following way -
Fs = 1000;
t= 0:1/Fs:1;
x = cos(2*pi*10*t) + cos(2*pi*60*t);
obw(x,Fs);
Please see MATLAB Documentation page on 'obw' for further references.
  2 件のコメント
Russell Geschrey
Russell Geschrey 2021 年 9 月 24 日
How did you get that graph?
Russell Geschrey
Russell Geschrey 2021 年 9 月 24 日
I see why I was not getting a graph. I was setting the output to a variable. If I just call the function alone it gives a graph. This is indeed a powerful function. Thank you for your help.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by