# dBc/Hz phase noise undefined function error?

7 views (last 30 days)

Show older comments

I am trying to use phaseNoiseMeasure (https://www.mathworks.com/help/msblks/ref/phasenoisemeasure.html) function to find dBc/Hz from the time domain data. But it gives me an error as an undefined function.

I also have the FFT data in dB with me, which also probably can be used to fine the dBc/Hz.

In general, I want to find the phase noise in dBc/Hz by any means. But I am lost in how should I get there.

##### 0 Comments

### Accepted Answer

Star Strider
on 11 Oct 2020

In a Comment in how to find fwhm using fwhm()? , you requested that I look at this, so I will do what I can.

I do not have that blockset. However looking at the online documentation for the function, it woud appear that it would be possible to use the Savitzky-Golay filter function sgolayfilt the smooth out the noise in the phase signal. You can then use the differences, absolute differences, or squared differences from the observed phase to get some sort of metric from it. The documentation does not describe its calculations, so I have no idea what the output should be. I have no idea what it does or how it works, since this is the first time I learned of its existence.

##### 4 Comments

Star Strider
on 12 Oct 2020

### More Answers (1)

Shanzeng Guo
on 14 May 2021

I also try to use phaseNoiseMeasure function to find dBc/Hz from the time domain data. But I got error messages. Here is my code for this exercise:

=========================

close all;

% Specify the parameters of a signal with a sampling frequency of 1 kHz and a signal duration of 1.5 seconds.

Fs = 20000; % Sampling frequency

T = 1/Fs; % Sampling period

L = 4000; % Length of signal samping points

t = (0:L-1)/Fs; % Time vector

pad=zeros(100,1);

%% LFM Signal -- A signal cotians two signals: f1, f2

fc=5000; % Hz

ffm=fc+800*t; % Hz

fam=0; %10;

theta=1; % important factor for umop

phs=1;

s1 = diag((1+0.5*cos(2*pi*fam*t))'*cos(2*pi*(ffm.*t)+phs*rand()/theta));

H = hilbert(s1');

% Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t).

Y = fft(H); % compute FFT

% 1. Compute the two-sided spectrum P2.

% 2. Then compute the single-sided spectrum P1 based on P2

% 3. and the even-valued signal length L.

P2 = abs(Y/L);

P1 = P2(1:L/2+1);

P1(2:end-1) = 2*P1(2:end-1);

P1=normalize(P1,'range');

% Define the frequency domain f and plot the single-sided amplitude spectrum P1.

% The amplitudes are not exactly at 0.7 and 1, as expected, because of the added noise.

% On average, longer signals produce better frequency approximations.

f = Fs*(0:(L/2))/L; % The max frequency that can be measured, based on Nyquist

figure;

hold on;

plot(f,P1)

title('Single-Sided Amplitude Spectrum of s1(t)-LFM1')

xlabel('f (Hz)')

ylabel('|P1(f)|')

%%

f1=f';

p1=P1';

rbw = 1e3;

FrOffset = [1e3 2e3 4e3 4e3];

PNTarget = [-56 -106 -132 -143];

PNMeasure = phaseNoiseMeasure(f1,p1,rbw,FrOffset,'on','Phase noise', PNTarget)

=====

Any help is appreciated.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!