2018-05-25 16:29 GMT+02:00 Doug Stewart <

[hidden email]>:

> On Fri, May 25, 2018 at 10:12 AM, Renato S. Yamane <

[hidden email]> wrote:

>>

>> Can someone give me an idea how to use the PWELCH?

>> My graphic have the "expected shape", but the axis are totally wrong.

>>

>> The image of the comparative graphics is below:

>>

https://ibb.co/bAZgAo>

> Can you show your code that produced the graph?

Hi Doug,

Here is:

==

sampling_rate = 44100;

length = 120;

hpf = 40;

lpf = 400;

filter_order = 4;

crest_factor = 12;

typenoise = noise((length)*sampling_rate, 1, 'pink');

[z, p, k] = butter(filter_order, [hpf/(sampling_rate/2),

lpf/(sampling_rate/2)]);

sos = zp2sos (z, p, k);

filtered = sosfilt(sos, typenoise);

normalized = filtered / (rms(filtered) / 10^(-crest_factor/20));

while (normalized(normalized > 1) || normalized(normalized < -1))

normalized(normalized > 1) = 1;

normalized(normalized < -1) = -1;

normalized = normalized / (rms(normalized) / 10^(-crest_factor/20));

endwhile

pwelch(normalized,hanning(4096), 'loglog');

==

Thank you,

Renato