Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. Fs=8;
  2. T=1/Fs;
  3. t=0:T:(1-T);
  4. f=1;
  5. x=sin(2*pi*f*t);
  6.  
  7. up_factor=2;
  8.  
  9. %% Deduce sinc from Fourier domain
  10.  
  11. xp=[zeros(1,5) x zeros(1,5)];
  12.  
  13. Xp=fft(xp);
  14.  
  15. door1D=abs(xp>0);
  16. sinc1D=fftshift(abs(fft(door1D)));
  17.  
  18. %plot(door1D);hold on;plot(fftshift(abs(sinc1D)))
  19.  
  20.  
  21.  
  22. %% Interp with sinc in spatial domain
  23. x_up=upsample(x,2);
  24. %plot(x,'b*');hold on;plot(x_up,'r*');
  25. x_up_interp=conv2(x_up,sinc1D,'same');
  26.  
  27. figure;
  28. plot(x_up_interp./up_factor);
  29. hold on;
  30. plot(x);
  31. hold on;
  32. plot(x_up,'r+');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement