rectpulse
Rectangular pulse shaping
Syntax
Description
Examples
Increase Sample Rates
Create an array of modulated symbols. The first channel (column) contains QPSK-modulated symbols. The second channel contains 16QAM-modulated symbols.
M_psk = 4; % PSK modulation order M_qam = 16; % QAM modulation order nsymb = 10; % Number of modulated symbols ch1 = pskmod(randi([0 M_psk - 1],nsymb,1),M_psk,pi/4); ch2 = qammod(randi([0 M_qam - 1],nsymb,1),M_qam); X = [ch1 ch2];
Plot the real and imaginary parts of the modulated symbols.
figure subplot(2,1,1) stem(real(X)) grid on xlabel('Symbols') ylabel('\Re(X)') subplot(2,1,2) stem(imag(X)) grid on xlabel('Symbols') ylabel('\Im(X)')
Set the number of samples per symbol.
nsamp = 4;
Perform rectangular pulse shaping and display the result.
Y = rectpulse(X,nsamp); figure subplot(2,1,1) plot(real(Y),'-') grid on xlabel('Samples') ylabel('\Re(y)') ylim([-3.5 3.5]) subplot(2,1,2) plot(imag(Y),'-') grid on xlabel('Samples') ylabel('\Im(Y)') ylim([-3.5 3.5])
Input Arguments
X
— Input symbols
vector | matrix
Input symbols, specified as a vector or matrix. If X
is a
matrix with multiple rows, the function treats the columns as independent
channels.
Data Types: double
| single
Complex Number Support: Yes
nsamp
— Number of samples per symbol
positive integer
Number of samples per symbol, specified as a positive integer.
Data Types: double
| single
Output Arguments
Y
— Output samples
vector | matrix
Output samples, returned as a vector or matrix.
If the input
X
is a vector, the output is an L-element vector consisting of each sample inX
repeatednsamp
times, where L islength(X)*nsamp
.If the input
X
is a matrix, the function processes each column as an independent channel and the output is an L-by-M matrix, where L issize(X,1)*nsamp
and M issize(X,2)
.
The data type is the same as that of X
.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced before R2006aR2024b: Add code generation support
The rectpulse
function adds support for C/C++ code
generation.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)