(SIGNAL) pwelch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

(SIGNAL) pwelch

yamane
Hi,

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

Thank you,
Renato


Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

Doug Stewart-4


On Fri, May 25, 2018 at 10:12 AM, Renato S. Yamane <[hidden email]> wrote:
Hi,

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

Thank you,
Renato



Can you show your code that produced the graph?


--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

yamane
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


Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

Doug Stewart-4


On Fri, May 25, 2018 at 10:36 AM, Renato S. Yamane <[hidden email]> wrote:
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


Try

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

This is closser to what you want
 
pwelch(normalized,hanning(4096), 'loglog');
==

Thank you,
Renato



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

Doug Stewart-4


On Fri, May 25, 2018 at 11:13 AM, Doug Stewart <[hidden email]> wrote:


On Fri, May 25, 2018 at 10:36 AM, Renato S. Yamane <[hidden email]> wrote:
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


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 | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

Doug Stewart-4


On Fri, May 25, 2018 at 11:31 AM, Doug Stewart <[hidden email]> wrote:


On Fri, May 25, 2018 at 11:13 AM, Doug Stewart <[hidden email]> wrote:


On Fri, May 25, 2018 at 10:36 AM, Renato S. Yamane <[hidden email]> wrote:
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


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))
   grid on 
but I don't know why!


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

Thank you,
Renato



--
DASCertificate for 206392




--
DASCertificate for 206392




--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

Mike Miller-4
In reply to this post by yamane
On Fri, May 25, 2018 at 16:12:32 +0200, Renato S. Yamane 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

If you believe there is a Matlab compatibility problem, please open a
bug report with the details. The Octave pwelch function should behave
identically to the Matlab function.

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: (SIGNAL) pwelch

yamane
2018-05-25 18:41 GMT+02:00 Mike Miller <[hidden email]>:

> On Fri, May 25, 2018 at 16:12:32 +0200, Renato S. Yamane 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
>
> If you believe there is a Matlab compatibility problem, please open a
> bug report with the details. The Octave pwelch function should behave
> identically to the Matlab function.

First of all, thank you Stewart! Now the axis are much better!!
Miller, I don´t have a Matlab available at this moment... The result
of the frequency response was compared using Audacity, on the image at
the link above.

Thank you,
Renato