Clear Filters
Clear Filters

Generating chirp with dsp.NCO system object in frame-based processing mode

13 views (last 30 days)
Dear all,
I want to generate a chirp with a dsp.NCO instance by inputting a column vector of phase increments in order to achieve frame-based processing. Most of the code I took from the example. The phase offset is constant and therefor set as property.
Fstart = 50; % start freq of chirp
Fstop = 1500; % stop freq of chirp
df = 0.05; % Frequency resolution = 0.05 Hz
minSFDR = 96; % Spurious free dynamic range >= 96 dB
Ts = 1/8000; % Sample period = 1/8000 sec
dphi = pi/2; % Desired phase offset = pi/2;
Fmom = linspace(Fstart,Fstop,1/Ts)'; % Momentary frequency
% Design the NCO source.
Nqacc = ceil((minSFDR-12)/6);
Nacc = ceil(log2(1/(df*Ts)));
phOffset = 2^Nacc*dphi/(2*pi);
nco = dsp.NCO('PhaseOffsetSource','Property',...
'PhaseOffset', phOffset,...
'NumQuantizerAccumulatorBits', 14,...
'SamplesPerFrame', 1/Ts, ...
'CustomAccumulatorDataType', numerictype([],Nacc));
% convert freqs to phase increments
phIncr = int32(round(Fmom.*Ts.*2.^Nacc));
% generate chirp signal with colomn input, one step only
y = nco(phIncr);
%plot chirp
t = 0:Ts:(1/Ts-1)*Ts;
plot(t,y)
In the plot you'll see that the output of the NCO remains at the start freq and does not provide the chirp.
Who can help me to get the dsp.NCO instance work with variable freqs in framebased mode?
Patrick

Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!