フィルターのクリア

Generate a random sequence of PAM-4 but with values -1,-0.33,0.33,1

8 ビュー (過去 30 日間)
Aastha Singla
Aastha Singla 2023 年 1 月 15 日
コメント済み: Aastha Singla 2023 年 1 月 16 日
How to create a random PAM-4 signal with amplitude values of -1, -.033, 0.33, 1?

回答 (1 件)

the cyclist
the cyclist 2023 年 1 月 15 日
編集済み: the cyclist 2023 年 1 月 15 日
I didn't research PAM-4 enough to know whether each element is independent from prior values. The following code will generate a sequence of a specified length, randomly (and independently) selecting each element from the list of amplitudes. Maybe that is what you need, or you can adapt the idea.
% Set a random number generator seed
rng(2)
% Set the signal length and amplitude list
signalLength = 7;
amplitudeValues = [1, -.033, 0.33, 1];
% Generate a random index into the amplitude list
idx = randi(numel(amplitudeValues),signalLength,1);
% Get the amplitudes
signal = amplitudeValues(idx)
signal = 1×7
-0.0330 1.0000 0.3300 -0.0330 -0.0330 -0.0330 1.0000
If you have the Statistics and Machine Learning Toolbox, you could use randsample to simplify the syntax:
signalLength = 7;
amplitudeValues = [1, -.033, 0.33, 1];
signal = randsample(amplitudeValues,signalLength,true)
signal = 1×7
0.3300 -0.0330 -0.0330 0.3300 0.3300 1.0000 0.3300

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by