MATLAB: How to recnstruct a signal from given discrete values

reconstruction

I have discrete values given in an array "xn". I wish to reconstruct the signal using sinc function (i.e. interpolation), but unable to achieve the target. small code is given as:
xn=[-0.0284 0.1123 0.1029 -0.0439 -0.1321 -0.0438 0.1030 0.1122 -0.0285 -0.1311 -0.0586 0.0922 0.1198 -0.0127 -0.1282 -0.0725 0.0801 0.1257 0.0034 -0.1234 -0.0854 0.0668 0.1297 0.0194 -0.1168 -0.0969];
% sin generation
%xn = A*sin(omega*n+theta);
n=0:25;
figure(1);
% plot
plot(n, xn, '-ro', 'LineWidth', 2,'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'r', 'MarkerSize',6);
title('A*sin(omega*n+theta)');
n1 = 0:length(xn)-1;
figure(2)
subplot(3,1,1);
stem(n1,xn,'r','linewidth',2); % Plotting samples separately
title('Samples');
xlabel('Time Axis','fontsize',8);
ylabel('Amplitude');
axis([0 length(xn) -0.15 0.15]);

Best Answer

I am not sure I understand the problem. It sounds to me that you need to find out the values of theta, omega and alpha. That is a curve fitting problem.
y=[-0.0284 0.1123 0.1029 -0.0439 -0.1321 -0.0438 0.1030 0.1122 -0.0285 -0.1311 -0.0586 0.0922 0.1198 -0.0127 -0.1282 -0.0725 0.0801 0.1257 0.0034 -0.1234 -0.0854 0.0668 0.1297 0.0194 -0.1168 -0.0969]';
x = (0:25)';
your_fit = fit(x,y,'sin1')