# Problems with the creation of a randomic signal

1 回表示 (過去 30 日間)
Andrea 2023 年 8 月 22 日
コメント済み: Andrea 2023 年 8 月 28 日
Hello everyone, i'm having a problem in my code, trying to create a random signal with monolateral bandwidth = 5 kHz, I wrote these lines:
fs=200000; %sampling frequency
B = 5000; %bandwidth
rng(1);
x = rand(1,n);
x = lowpass(x,B,fs);
The problem is that the signal thus obtained has a monolateral bandwidth = 20 kHz. What am i doing wrong? Anyone to suggest me what i should correct?
Below the signal i get with my lines, my goal is to get a signal which, zooming in the image, like i did in the left picture, has a bandwidth = 0.5. I really hope someone can help me out. Thanks in advance.

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

### 採用された回答

Paul 2023 年 8 月 23 日
Hi Andrea,
How are you defining the bandwdith?
fs=200000; %sampling frequency
B = 5000; %bandwidth
rng(1);
n = 1e4; % not supplied in the Question
x = rand(1,n);
lowpass can return the digital filter used to process the signal
[xf,d] = lowpass(x,B,fs);
figure
[h,freq]=freqz(d,4096,fs);
plot(freq,abs(h)),grid
xline(5e3)
Is that not the desired amplitude response of the filter? It seems to match up well with your plot.
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
Andrea 2023 年 8 月 28 日
Thank you, I just needed to add a steepness parameter to my bandpass function.

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

### カテゴリ

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

R2023a

### Community Treasure Hunt

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

Start Hunting!

Translated by