Hi,
You can refer to the below code to find DFT of x= [1 1 6 1 6 0 2 6]
%input sequence x
x = [1 1 6 1 6 0 2 6];
% Calculate the DFT of x using the FFT function
X = fft(x);
N = length(x); % Length of x
f = (0:N-1)/N; % Frequency vector
figure
subplot(2,1,1)
stem(f, abs(X))
title('Magnitude spectrum')
xlabel('Frequency (cycles/sample)')
ylabel('Magnitude')
subplot(2,1,2)
stem(f, angle(X)*180/pi)
title('Phase spectrum')
xlabel('Frequency (cycles/sample)')
ylabel('Phase (degrees)')