Formulating a function on Matlab for the Shannon interpolation formula I am trying to formulate an algorithm for applying to Shannon interpolation formula to the discrete signal

$$x[n]=\frac{c^2}{4}\int\limits_{0}^{n T}y\left(\tfrac{c}{2}s\right)\,ds,$$

where $c$ is constant. Now, if $\frac{1}{T}=f_{s}&gt;2B$, where $B$ is the band-limit of $X(f)$, then we can reconstruct the continuous time signal as:

$$x_{\text{const}}(t)=\sum\limits_{n=-\infty}^{\infty}\frac{c^2}{4}{\int\limits_{0}^{n T}y\left(\tfrac{c}{2}s\right)\,ds}\cdot\text{sinc}\left(\frac{t-n T}{T}\right)$$

function x=interpolate(y,N,T,c)
     x=0;
     for n=1:N
         x=x+((c^2)/2)*integral(y,0,n.*T).*sinc((t-n.*T)./T);
     end


However, I am having trouble with incorporating the t variable here. Setting it as global and running interpolate(y,20,20,1) also produces nothing to note.

Note that the continuous time signal in question is given by

$$x_{\text{true}}(t)=\frac{c^2}{4}\int_{0}^{t}y\left(\tfrac{c}{2}s\right)\,ds.$$
Given your samples $x[n]$, here's a code to perform the interpolation by the sinc-functions:

F = 1000; % the sampling frequency used for drawing the continuous function
Fs = 50; % the sampling frequency
T = 1/Fs; % the sampling time

t = 0:1/F:1; % the time-samples for "continuous" plotting
ts = 0:T:1;  % the time at the sample points

% the original function. In your case, this would be integral expression
x = @(t) sin(2*pi*10*t) + cos(2*pi*11*t); 
xn = x(ts);  % the discrete sequence 

% perform interpolation from xn to x:
interpolated = 0;
for n=1:length(ts)
    % n-1 due to the 1-based indexing of matlab
    interpolated = interpolated + xn(n) * sinc((t-(n-1)*T)/T);
end

hold off;
plot(t, x(t), 'r', 'linewidth', 3); hold on;  % plot continuous
stem(ts, xn);  hold on; % plot sampled
plot(t, interpolated, 'k-o'); % plot interpolated on top of red curve




As a bonus, here's what happens when the signal is not enough bandlimited: I changed the frequency of the first sine from $sin(2\pi 10 t)$ to $sin(2\pi 30 t)$:


Note: The Shannon-Interpolation requires bandlimited signals, so in particular it does not work exactly with time-limeted signals (since these are never band-limited). So, you will see some deviations especially at the edge of the signal.