Question & Answer: D Assignment-5(2).pdf ← → c Secure Apps G Google X、eChegg Study! Guidedsx https: app.lms unimelb.edu.au/bbcs…..

Please do in MATLAB

D Assignment-5(2).pdf ← → c Secure Apps G Google X、eChegg Study! Guidedsx https: app.lms unimelb.edu.au/bbcswebdav/pid-5834079-dt content rid-24294143 2/courses/ENGR10003 2017 SM2/Assignment 596282%29.pdf Hint: You may adapt the Fibonacciwhile.m example program introduced in the lectures. Question 2 [15 Marks] Write a function nybblise which takes as input digital signal of 0s and 1s stored in a vector of size N x 1, and breaks into four 4-bit nybbles, which are returned as the columns of a 4 x N/4 matrix. For example, the 16 bit input should be mapped as: d2 16 Your function must return -1 if the N is not a multiple of 4 Following is the signature of the function function A = nybblise(d) Input: d digital signal as a vector of size Nx 1 9.56 PM Type here to search di 14/09/2017 E ^

D Assignment-5(2).pdf ← → c Secure Apps G Google X、eChegg Study! Guidedsx https: app.lms unimelb.edu.au/bbcswebdav/pid-5834079-dt content rid-24294143 2/courses/ENGR10003 2017 SM2/Assignment 596282%29.pdf Hint: You may adapt the Fibonacciwhile.m example program introduced in the lectures. Question 2 [15 Marks] Write a function nybblise which takes as input digital signal of 0’s and 1’s stored in a vector of size N x 1, and breaks into four 4-bit nybbles, which are returned as the columns of a 4 x N/4 matrix. For example, the 16 bit input should be mapped as: d2 16 Your function must return -1 if the N is not a multiple of 4 Following is the signature of the function function A = nybblise(d) Input: d digital signal as a vector of size Nx 1 9.56 PM Type here to search di 14/09/2017 E ^

Expert Answer

 

Below is the matlab code and sample inputs/outputs are attached. Description is provided in commets itself.

Matlab code:

main.m

d = [1 2 3 4 5 6 7 8 9 10 11 12 13]’ %d-vector
A = nybblise(d) % calling function nybblise

​nybblise.m

function A = nybblise(d)
N = size(d,1); % number of elements in vector d
if mod(N,4)!=0 % if number of elements are not multiple of 4
A = -1; % set A=-1
else
for row = 1:N
row_num = mod(row,4); % evaluate row number for A
col_num = floor(row/4)+1; % evaluate column number for A
if row_num==0 % adjustment
row_num = 4;
col_num = col_num-1;
end
A(row_num, col_num) = d(row,1); % set A(row,col) to corresponding value
end
end
end
Sample input/Output:

1.

2.

Still stressed from student homework?
Get quality assistance from academic writers!