Skip to content

Instantly share code, notes, and snippets.

@eggie5
Created September 15, 2013 05:21
Show Gist options
  • Select an option

  • Save eggie5/6568237 to your computer and use it in GitHub Desktop.

Select an option

Save eggie5/6568237 to your computer and use it in GitHub Desktop.
working 0 padded interpolation
function [y, indexy] = myinterpolate(x, N, a_x, b_x)
a=a_x;
b=b_x;
x_axis=a:b;
x_axis_exp=a:length(x_axis)*N;
x_axis_norm=1:length(x_axis_exp);
y=[];
indexy=[];
for(i=x_axis_norm)
k=x_axis_exp(i);
if(mod(k, N)==0) % sample
x_val=x(k/N);
y=[y x_val];
else % interpolate
y=[y 0];
end
indexy=[indexy i];
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment