%% Simple Matlab Exercise:
A = ([ 1 0 0 1 ]);
B = ([ 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 ]);
C = ([ 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 ]);
% A is hidden within B and C as multiples of its bits with long
pauses (many zeros) at the % beginning and end of the vectors
% Develop a matlab program by which A can be recovered from B or
C
Ans)
There are many ways you can get 'A' from B or C,as there is no proper logic given how vector 'B' and 'C' is formed from vector 'A', I am writing simple matlab code for the above question because we know both inputs and outputs
%============MATLAB Code============%
B=([0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0]);
C=([0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0]);
A=[B(7) B(9) B(11) B(13)] % this line recovers vector A from B
A=[C(9) C(12) C(15) C(18)] % this line recovers vector A from C
========================
Output when you run the above code
=========
>>
A = 1 0 0 1
A = 1 0 0 1
Get Answers For Free
Most questions answered within 1 hours.