Comment generer une gapped clock avec Simulink

3 visualizzazioni (ultimi 30 giorni)
Andrea Fontana
Andrea Fontana il 19 Lug 2024
Risposto: Suraj Kumar il 31 Lug 2024
Une gapped clock est utilisé dans les implementations telecom pour pouvoir demapper une payload avec un bitrate M depuis un signal qui a un bitrate N. Avec M<N.
Pratiquement on utilise un clock lié à la frequence du bitrate N, auquel, de temps au autres on enlève un pulse.
Un exemple dans l'image en pj.
Dans mon cas, il y a un premier skip après 11 cycles et ensuite un skip après 12 cycles. Ensuite la sequence se repète ... 11 cycles - skip - 12 cycles - skip ... etc etc
J'aurais besoin de generer ce type de signal pour ensuite l'étudier en analyse spectrale.
Pourriez-vous me donner des indication de comment generer sous Simulink ?
Merci d'avance

Risposte (1)

Suraj Kumar
Suraj Kumar il 31 Lug 2024
Hi Andrea,
Based on my understanding, you want to generate signals similar to a gapped clock i.e. to skip the pulse after a few cycles. To generate the required signals, you can follow these steps:
1. Add the following blocks onto the Simulink canvas:
  • Pulse Generator Block: Generates a periodic pulse and acts as an input to MATLAB Function block.
  • MATLAB Function Block: Implements the logic to skip specific cycles.
  • Scope Block: Visualizes the output signal from the MATLAB Function Block.
2. Configure the Pulse Generator Block with the following parameters:
  • Amplitude = 1 , sets the height of the pulse signal
  • Period = 1 , defines the duration of one complete cycle
  • Pulse Width = 50% , sets the duty cycle of the pulse.
3. Implement the following logic in the MATLAB Function Block to skip cycles as required :
function y = skip_cycles(u)
% Persistent variable to keep track of the cycle count
persistent cycle_count;
if isempty(cycle_count)
cycle_count = 0;
end
cycle_count = cycle_count + 1;
if cycle_count > 23
cycle_count = 1;
end
% Skip cycle logic
if cycle_count == 12 || cycle_count == 23
y = 0;
else
y = u;
end
end
4. Run the model and observe the results from the Scope Block.
You can refer the output given below:
For more information on the ‘Pulse Generator’,’ MATLAB Function’ and ‘Scope’ blocks in Simulink, kindly refer to the following documentations:
Hope this helps!

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!