Generate a square pulse

조회 수: 9 (최근 30일)
Ahmed Hassanen
Ahmed Hassanen 2021년 11월 3일
답변: Abhinaya Kennedy 2024년 6월 12일
create exactly one square pulse with the specified parameters. This square pulse should be stored in the array called one_square. The dimensions of this array should be 1 x N_sq_pos. The length of the square pulse you generate should be equal to N_sq_pos, i.e., the variable one_square should not change dimensions after you generate the pulse. Keep in mind that you have to set the energy of the square pulse to be equal to E_bit.
Inputs:
% t_axis: Time axis
% T_sq_dur: Duration of the square pulse in seconds
% E_bit: Total energy in all samples of one square pulse
% fs: Sampling frequency
% x_bits: Sequence of input bits (if not available, then it is equal
% to 1)
% type: Type of bit coding, 'RZ' or 'NRZ' (default is 'RZ')
% Outputs:
% x_square: The sequence of samples corresponding to the pulse shaping
% of the input bits using a square pulse shape
Output like this :
  댓글 수: 1
Ahmed Hassanen
Ahmed Hassanen 2021년 11월 3일
편집: Ahmed Hassanen 2021년 11월 3일
Fixed Parameter:
fs = 1e5; % Sampling rate (samples per sec)
Ts = 1/fs; % Sampling time
N = 102400 - 1; % Total number of samples
t_axis = (0:N-1)*Ts; % Time axis (the same during the entire experiment)
f_axis = -fs/2:fs/N:fs/2-1/N; % Frequency axis (the same during the entire experiment)
T_sq = 100*Ts; % The duration of the square pulse (an integer number of sampling times)

댓글을 달려면 로그인하십시오.

답변 (1개)

Abhinaya Kennedy
Abhinaya Kennedy 2024년 6월 12일
Generating the Pulse:
  1. Create a time axis "(t_axis)" from "0" to "T_sq_dur" with samples based on "fs".
  2. Calculate pulse amplitude (A) using "A = sqrt(E_bit / T_sq_dur)".
  3. Generate a binary sequence "(x_square)" with "x_bits" for the pulse duration (considering RZ transitions if applicable).
  4. Scale the sequence by A to get the final pulse with the required energy level.\
Array Dimensions:
The pulse ("one_square") should be a 1 x N_sq_pos array, where N_sq_pos is the number of samples based on "fs". This ensures the array maintains its size after generation.
By following these steps, you can create a square pulse and store it in the "one_square" array for further use.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by