I am not able to get this error removed. Can someone please help me. The problem is it is showing some error in step 4 while generation of hdl code.
function [Rxx]=autom(X) % [Rxx]=autom(x)
Rxx=zeros(1,1024);
for m=1: 1025
for n=1: 1025-m
Rxx(m)=Rxx(m)+X(n)*X(n+m-1);
end
end
%testbench
N=1024; % Number of samples
f1=1; % Frequency of the sinewave
FS=200; % Sampling Frequency
n=0:1023; % Sample index numbers
X=zeros(1,1024);
% X=sin(2*pi*1*(0:1023)/200);
X=sin((2*pi*1.*n)./200);
t=[1:1024]*(1/200);
%ti=f1*n/FS;
%x=sin(2*pi*ti); % Generate the signal, x(n)
%t1=[1:N];
%t=t1*(1/FS); % Prepare a time axis
subplot(2,1,1); % Prepare the figure
plot(t,X);
title('Sinwave of frequency 1000Hz [FS=8000Hz]');
xlabel('Time, [s]');
ylabel('Amplitude');
grid;
Rxx = autom(X(1:1024)); % Calculate its autocorrelation
subplot(2,1,2);
plot(Rxx);
title('Autocorrelation function of the sinewave'); % Plot the autocorrelation
xlabel('lags');
ylabel('Autocorrelation');

The error says: "[...] unsuported dynamic matrix
X[...]"Your problem is that in your function you are doing
X(n)*X(n+m-1);and it seem to be understanding that this is dynamically changing the size of the matrix. I suspect in fact that the error is inRxxNote that your
Xis 1024 on length, but your iterations ofnandmare 1025 in length.Rxxis 1024 on length, but you doRxx(m)andmgoes up to 1025, thus dynamically changing its size (MATLAB will increase the size ofRxxfrom 1024 to 1025, dynamically)Are you sure you dont want