MATLAB code please type Problem-4: strings, Encryption Words can be shifted usin
ID: 2268598 • Letter: M
Question
MATLAB code please type
Problem-4: strings, Encryption Words can be shifted using the functions char and double. For example, one can convert from uppercase to lowercase by adding 32 from the character codes >> upper-text = 'APPLE'; » lower text = char (double (upper text) +32) lower text = apple » upper-text char (double (lower-text)-32) = upper-text = APPLE A string was "encrypted" to obtain the code below. Figure out the original string. Using a loop, try adding or subtracting different values until you decipher it. Note that you should be able to decipher the code with less than 20 loop iterations. Return the decoded string and the MATLAB script used to decipher it. code = 'K.j , j gikkp Zffc @ ZXe Y X jgp 1 'Explanation / Answer
Matlab Script:
code = 'K_`j `j gikkp Zffc @ ZXe Y X jgp 1 ';
for i=-9:9 %took iterations 19 less than 20
decode = char(double(code)+i)
disp(i);
end
and at i=9 we got correct codeword that is
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.