Clear Filters
Clear Filters

How to generate pulsed waveform of gold sequence?

7 views (last 30 days)
Basmah Ahmad
Basmah Ahmad on 26 Jan 2024
Edited: Umeshraja on 21 Sep 2024 at 12:15
I want to convert this following gold sequence into pulsed waveform, how do i do it?
code2 = comm.GoldSequence('FirstPolynomial','x^6+x+1', 'FirstInitialConditions',[ 0 0 0 0 0 1], 'SecondPolynomial','x^6 + x^5 + x^4 + x^3 + x^2 + x + 1', 'SecondInitialConditions',[0 0 0 0 0 1], 'Index',2, 'SamplesPerFrame',63);
gold_Code = code2();
The parameters are PRF = 50000, fs = 100e+06, center_frequency = 50000, bw = 10e+05.
Please guide me

Answers (1)

Umeshraja
Umeshraja on 3 Sep 2024
Edited: Umeshraja on 21 Sep 2024 at 12:15
If you're interested in generating pulsed waveforms of a Gold sequence, the Phased Array System Toolbox™ offers several options for creating baseband pulsed waveforms. Below is an example demonstrating how to create both Rectangular and Linear Frequency Modulated (LFM) pulses.
The code below generates a Gold sequence followed by modulating two types of waveforms: a Rectangular waveform and a Linear Frequency Modulated (LFM) waveform. Each bit of the Gold sequence determines whether a pulse or a zero sequence is appended to the final waveform. The result is a concatenation series of pulses that can be visualized.
% Define parameters
N = 63; % Number of bits
PRF = 50000; % Pulse Repetition Frequency in Hz
Fs = 100e6; % Sampling frequency in Hz
BW = 10e5; % Bandwidth in Hz
PW = 2/BW; % Pulse width
% Configure the Gold sequence generator
code2 = comm.GoldSequence('FirstPolynomial','x^6+x+1', ...
'FirstInitialConditions',[0 0 0 0 0 1], ...
'SecondPolynomial','x^6 + x^5 + x^4 + x^3 + x^2 + x + 1', ...
'SecondInitialConditions',[0 0 0 0 0 1], 'Index',2, ...
'SamplesPerFrame',63);
% Generate the Gold sequence
gold_Code = code2();
% Create rectangular and LFM waveform objects
rectWaveform = phased.RectangularWaveform('PulseWidth', PW, ...
'PRF', PRF, ...
'SampleRate', Fs);
linearFMWaveform = phased.LinearFMWaveform('PRF', PRF, ...
'PulseWidth', PW, ...
'SampleRate', Fs, ...
'SweepBandwidth', 200e4);
% Generate base pulses
basePulseRect = rectWaveform();
basePulseLinearFM = linearFMWaveform();
% Initialize waveforms
waveformRec = [];
waveformLinearFM = [];
% Create the modulated waveform
for i = 1:N
if gold_Code(i) == 1
waveformRec = [waveformRec; basePulseRect]; % Append pulse for bit 1
waveformLinearFM = [waveformLinearFM; basePulseLinearFM];
else
waveformRec = [waveformRec; zeros(size(basePulseRect))]; % Append zeros for bit 0
waveformLinearFM = [waveformLinearFM; zeros(size(basePulseLinearFM))];
end
end
% Time vector for the entire waveform
t = (0:length(waveformRec)-1) / Fs;
% Plot the waveforms
figure;
subplot(2,1,1)
plot(t, waveformRec);
xlabel('Time (s)');
ylabel('Amplitude');
title('Rectangular Pulsed Waveform of Gold Code');
grid on;
axis([0 N/PRF -0.2 1.2])
subplot(2,1,2)
plot(t, real(waveformLinearFM));
xlabel('Time (s)');
ylabel('Amplitude');
title('Linear Frequency Modulated Pulsed Waveform of Gold Code');
grid on;
axis([0 N/PRF -1.2 1.2])
Feel free to adjust the parameters to meet your specific application or specifications.
To know more on the Pulsed Waveforms, please refer to the following documentations

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!