I'm using 2020 version but, I don't know how to change code from 2015 version
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
2 lines codes are 2015 version
hmodem = modem.qammod(0:M-1, M, 'bin', 'UnitAveragePower', true)
all_sym = modulate(hmodem,binary);
some staffs adviced me but, these weren't useful and helpful so, i want to know detail to change methods in 2020 version from 2015 version.
please tell me about 2lines
2 Comments
Rik
on 10 Oct 2020
Generally when a function is removed both the documentation and the release notes will contain advice about alternatives. Where did you search?
Choi
on 10 Oct 2020
Sorry sir, I was mistake upload my codes
original code is hmodem = modem.qammod('M',M, 'SymbolOrder', 'Gray','InputType', 'bit')
and all_sym = modulate(hmodem,binary);
i want to change in 2020version
Accepted Answer
Walter Roberson
on 10 Oct 2020
Edited: Walter Roberson
on 10 Oct 2020
The R2020a version of that code is:
error('comm:modem:InvalidUsage', 'Invalid usage. Type ''help modem.qammod'' to see correct usage.')
Details:
The first parameter to modem.qammod can never be a vector: it must be either a scalar (M) or else an existing modem.qammod object, or else a character vector that is part of a name / value pair.
The second parameter to modem.qammod can only be numeric if the first parameter was a numeric scalar (in which case the second parameter can be the phase offset) -- or if the first parameter was a character vector such as 'M'
The 'bin' option can only occur if it is part of a name/value pair and the proceeding option name is 'SymbolOrder'
The option 'UnitAveragePower', true was valid in R2015a -- and is also valid in the current qammod() call.
all_sym = modulate(hmodem,binary);
You can only pass binary to modulate if the modem.qammod object was created with M = 2, or if it was created with 'InputType', 'bit' . Otherwise you need to pass integers to modulate()
For the reasons described above, it is not possible for the call you gave to work, so the R2020a version of the code would have to be to issue the same error message as would have been given in R2015.
13 Comments
Choi
on 10 Oct 2020
Edited: Walter Roberson
on 10 Oct 2020
Sorry sir, I was mistake upload my codes
original code is
hmodem = modem.qammod('M',M, 'SymbolOrder', 'Gray','InputType', 'bit')
and
all_sym = modulate(hmodem,binary);
i want to change in 2020version
all_sym = qammod(binary, M, 'gray', 'InputType', 'bit');
Choi
on 10 Oct 2020
Thank you sir, then is first code hmodem = qammod('M',M, 'SymbolOrder', 'Gray','InputType', 'bit') ??
No. There is no modern equivalent for creating a modem.qammod object to be used for later modulation -- at least not using that series of calls. (There are comm.* system objects https://www.mathworks.com/help/comm/ref/comm.rectangularqammodulator-system-object.html but they will be removed soon.)
The code I posted,
all_sym = qammod(binary, M, 'gray', 'InputType', 'bit');
replaces both lines of
hmodem = modem.qammod('M',M, 'SymbolOrder', 'Gray','InputType', 'bit') ;
all_sym = modulate(hmodem,binary);
Choi
on 10 Oct 2020
Thank you so much.
can i ask my one question?
i changed code lines are these correct? I marked %%%%%%
decimal = 0:M-1;
binary = de2bi(decimal(:), log2(M) ,'left-msb')';
% all_sym = modulate(hmodem,binary);
all_sym = qammod(binary, M, 'gray', 'InputType', 'bit');
inactive = [0];
symbol = (1/sqrt(42))*[inactive;all_sym.'];
nn=10000;
for kk = 0:2:24
kk
for vv = 1:nn
bit_T = randi([0 1],Nbits,1);
x = reshape(bit_T,2*Nobit+Nt,[]);
ante = bi2de(x(1:Nt,:).' , 'left-msb') + 1;
% digMod1 = modulate(hmodem,x(Nt+1:Nt+Nobit,:));
% digMod2 = modulate(hmodem,x(Nt+Nobit+1:Nt+2*Nobit,:));
%%%%%%%%%
digMod1 = qammod(x(Nt+1:Nt+Nobit,:),M);
digMod11 = datasample(digMod1,1);
digMod2 = qammod(x(Nt+Nobit+1:Nt+2*Nobit,:),M);
digMod22 = datasample(digMod2,1);
digMod3 = [digMod11;digMod22];
%%%%%%%%%%
No, that is not correct.
digMod1 = qammod(x(Nt+1:Nt+Nobit,:), M, 'gray', 'InputType', 'bit');
digMod11 = datasample(digMod1,1);
digMod2 = qammod(x(Nt+Nobit+1:Nt+2*Nobit,:), M, 'gray', 'InputType', 'bit');
digMod22 = datasample(digMod2,1);
digMod3 = [digMod11;digMod22];
Choi
on 11 Oct 2020
Thank you sir,
this is 2015 version code digMod1 = modulate(hmodem,x(Nt+1:Nt+Nobit,:))
and this code is 2020 versiondigMod1 = qammod(x(Nt+1:Nt+Nobit,:), M, 'gray', 'InputType', 'bit');
i want to extract 1x1 in this code but appear error 'Index in position 1 exceeds array bounds (must not exceed 4) '
data_to_modulate = x(Nt+1:Nt+Nobit,:);
digMod1 = qammod(data_to_modulate, M, 'gray', 'InputType', 'bit');
splitting the command in this way will make it easier to see whether the problem is in the indexing into x, or if the problem is in internal to qammod()
Choi
on 13 Oct 2020
Thank you sir work well now. Thanks to your answer and something changed.
Choi
on 13 Oct 2020
if i have question, can i tell you??
Walter Roberson
on 13 Oct 2020
You can post new Questions as you need to.
Sometimes I will notice them; sometimes I will not.
Pavankalyan D S
on 8 Aug 2021
hmodem = modem.qammod('M',M, 'SymbolOrder', 'Gray','InputType', 'bit');
hdemodem = modem.qamdemod('M', M,'SymbolOrder','Gray','OutputType','bit');
I change them to qammod, again getting error
Pavankalyan D S
on 8 Aug 2021
the error:
Error in qammod (line 93)
plotConstellation, outputDataType] = validateInputArgs(M, varargin{:});
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!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)