New to MATLAB? See resources for Getting Started.
>>
4 usages of "M" found
UTF-8
LF
script

Create a channel object

% rayChan = comm.RayleighChannel('SampleRate',100000,'MaximumDopplerShift',130,...
% 'PathDelays',[0 1.5e-5 3.2e-5],'AveragePathGains',[0, -3, -3],...
% 'Visualization','Impulse response');
Generate a bit stream and create a modulator object. Modulate the bit stream and pass the
modulated DBPSK signal through the channel by calling the channel object.
% tx = randi([0 1],500,1);
% dbspkMod = comm.DBPSKModulator;
% dpskSig = dbspkMod(tx);
% y = rayChan(dpskSig);

Rayleigh Fading Channel

% rayChan = comm.RayleighChannel('SampleRate',10000,'MaximumDopplerShift',100);
% sig = j*ones(2000,1); % Signal
% out = rayChan(sig); % Pass signal through channel.
% rayChan % Display all properties of the channel object.
% plot(20*log10(abs(out)))

Channel Filtering Using For Loop

bitRate = 50000; % Data rate is 50 kb/s
numTrials = 125; % Number of iterations of loop
M = 4; % QPSK modulation order
qpskMod = comm.QPSKModulator;
rayChan = comm.RayleighChannel('SampleRate',bitRate,'MaximumDopplerShift',4,'PathDelays',[0 2e-5],'AveragePathGains',[0 -9]);
rayChan.Visualization = 'Impulse response' % Enables the impulse response channel visualization
rayChan =
comm.RayleighChannel with properties: SampleRate: 50000 PathDelays: [0 2.0000e-05] AveragePathGains: [0 -9] NormalizePathGains: true MaximumDopplerShift: 4 DopplerSpectrum: [1×1 struct] ChannelFiltering: true PathGainsOutputPort: false Show all properties
g = rayChan.AveragePathGains % Retrieve the AveragePathGains property of rayChan
g = 1×2
Rows 1: | Columns 1:2
0 -9
scatterPlot = comm.ConstellationDiagram;
rng(0)
for n = 1:numTrials
tx = randi([0 M-1],500,1); % Generate random bit stream
pskSig = qpskMod(tx); % PSK modulate signal
fadedSig = rayChan(pskSig); % Apply channel effects
% Plot the new data from this iteration.
update(scatterPlot,fadedSig);
end
1
2
3
4
5
6
7
8
9
File
Variable
Code
Simulink
Environment
Resources
File
Optimization
Set up and solve optimization problems (optimtool)
Signal Analyzer
View, analyze, and compare signals (signalAnalyzer)
Curve Fitting
Fit curves and surfaces to data (cftool)
PID Tuner
Tune PID controllers (pidTuner)
Classification Learner
Train models to classify data using supervised machine learning (classificationLearner)
Deep Network Designer
Design, visualize, and train deep learning networks (deepNetworkDesigner)
Experiment Manager
Design and run experiments to train and compare deep learning networks (experimentManager)
Apps
File
Navigate
Text
Code
Section
Run