help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (SIGNAL) pwelch


From: Doug Stewart
Subject: Re: (SIGNAL) pwelch
Date: Fri, 25 May 2018 11:31:58 -0400



On Fri, May 25, 2018 at 11:13 AM, Doug Stewart <address@hidden> wrote:


On Fri, May 25, 2018 at 10:36 AM, Renato S. Yamane <address@hidden> wrote:
2018-05-25 16:29 GMT+02:00 Doug Stewart <address@hidden>:
> On Fri, May 25, 2018 at 10:12 AM, Renato S. Yamane <address@hidden> 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


Try

pxx=pwelch(normalized,hanning(4096),[],sampling_rate,'db');
semilogx(10*log10(pxx))

This is closser to what you want
 

This is closer still
semilogx(10*log10(pxx./1200))
but I don't know why!


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

Thank you,
Renato



--
DASCertificate for 206392




--
DASCertificate for 206392


reply via email to

[Prev in Thread] Current Thread [Next in Thread]