Question

In: Computer Science

USING MATLAB In signal processing applications, the Hankel matrix is useful. The elements of a (N...

USING MATLAB

In signal processing applications, the Hankel matrix is useful. The elements of a (N × N) Hankel matrix are given by

h?? =0   ?+?−1>?

=?+?−1 otherwise

Write a script that takes as input from the user an integer, n. Your code should accept input ≥1 and <10. The user should be repeatedly prompted until acceptable input is entered. Next, create n Hankel matrices for N=1,2,...,n. That is, if the user enters 4, you’ll generate 1×1, 2×2, 3×3, and 4×4 Hankel matrices, then display them as shown below (on next page). The spacing doesn’t need to be identical to my answer, but try to get it as close as possible. Hint: Use for loops.

1x1 Hankel matrix:

1

2x2 Hankel matrix:

1 2

2 0

3x3 Hankel matrix:

1 2 3

2 0 0

3 0 0

4x4 Hankel matrix:

1 2 3 4

2 0 0 0

3 0 0 0

4 0 0 0

Solutions

Expert Solution

MATLAB Code:

% MATLAB Script that generates Hankell Matrix

clc;
clear;

% Reading N value
N = input("Enter N value: ");

% Loop till valid value is entered
while N<1 || N>=10
% Reading N value again
N = input("\nInvalid N Value!!! Re-Enter N value: ");
end % While end

% Creating N Hankell Matrics
for k=1:N
  
% Printing message
fprintf("\n%dx%d Hankel matrix:\n", k, k);
  
% Creating kxk Matrices
for i = 1:k
for j = 1:k
% Checking values
if (i+j-1) > k
fprintf("%-3d", 0);
else
fprintf("%-3d", (i+j-1));
end % If end
end % Inner for
fprintf("\n");
end % Outer for
end % Top for
____________________________________________________________________________________________

Sample Run:


Related Solutions

By using MATLAB 1. Divide a speech signal or music signal into frames of size N...
By using MATLAB 1. Divide a speech signal or music signal into frames of size N = 64. 2. Compute the N?point DFT of each frame. 3. Save only first L = 20 DFT coefficients. 4. Reconstruct the frame from these L coefficients. (Do not disturb the symmetry of DFT during inverse DFT computation. X[k] = X[N ?k] for real signals, N = 64 here. Pad zeros for missing DFT coefficients.) 5. Comment on the quality of reconstructed and the...
Make a code in matlab to know the determinant of a matrix n x n, using...
Make a code in matlab to know the determinant of a matrix n x n, using the sarrus rule.
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is...
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is x(t) then the echo is y(t) = x(t) + alpha*x(t-delay) This code below creates this echo however I don't understand how every line of the code works, could someone comment this code so I can understand? [x,Fs] = audioread('Hallelujah.wav'); sound(x,Fs); delay = 0.5; % 0.5s delay alpha = 0.65; % echo strength D = delay*Fs; y = zeros(size(x)); y(1:D) = x(1:D); for i=D+1:length(x) y(i)...
Consider the finite duration signal x(n) = (0.9)ncos(0.1πn) for 0 ≤ n ≤ 31. Using MATLAB:...
Consider the finite duration signal x(n) = (0.9)ncos(0.1πn) for 0 ≤ n ≤ 31. Using MATLAB: a.) Plot the signal b.) Plot the real part of the DFT of x(n), the imaginary part of the DFT of x(n) and the DCT of x(n). All transforms are length N = 32.
Signals and systems Consider the following discrete signal x[n] = sin(π n/32) (u[n]-u[n-33]) a) Using MATLAB...
Signals and systems Consider the following discrete signal x[n] = sin(π n/32) (u[n]-u[n-33]) a) Using MATLAB only, Find the DFT using FFT algorithm, b) Plot the signal x[n], spectrum |X(ω)|^2 , and phase of X(ω). Hint: use L=512 for FFT.
I have a 3-D matrix with (100,100,100) elements in Matlab, but it exceeds the limit of...
I have a 3-D matrix with (100,100,100) elements in Matlab, but it exceeds the limit of display. I want to extract those values from Matlab to excel. I want to know how to extract all the data values?
Realize signal processing systems described by the difference equation: ?1(?)=1/2 [?(?)+?(?−1)] and ?2(?)=1/2 [?(?)−?(?−1)] using Matlab....
Realize signal processing systems described by the difference equation: ?1(?)=1/2 [?(?)+?(?−1)] and ?2(?)=1/2 [?(?)−?(?−1)] using Matlab. Assuming same input signal x(n)=sin(ωn) for various values of ω ={0,p/6 ,3p/2, 1.9p/2} applied to both systems find the following: a. Obtain stem plots and codes of y1(n) and y2(n) in each . b. Critically analyze y1(n) and y2(n) in terms of type of filter, maximum gain and cut off frequency. (Hint : The system can be tested by computing frequency response of the...
Q No 1: Explain two applications of digital signal processing in detail. Q No 2: What...
Q No 1: Explain two applications of digital signal processing in detail. Q No 2: What is meant by digital signal processor? Explain architecture of any of the digital signal processor.
a) List some applications which find batch-mode processing useful. Justify your answer. b) List some applications...
a) List some applications which find batch-mode processing useful. Justify your answer. b) List some applications which find interactive-mode processing useful. Justify your answer
Write a program in a script file that creates m × n matrix with elements that...
Write a program in a script file that creates m × n matrix with elements that have the following values. The value of each element in the last row is the number of the column. The value of each element in the last column is the number of row +1. For the rest of the elements, each has a value equal to the sum of the element below it and the element to the right.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT