## upsample2 - Upsample without extra overhead zeros

This is a simple function to replace the one from MATLAB. The problem is that the original function adds extra overhead zeros at the end of the vector, but sometimes it would be desired to get a vector with just zeros BETWEEN the actual samples.

This function is required by several programs related to the DWT transform, which is posted in the following blog post:

http://www.dsprelated.com/showarticle/115.php

```
% David Valencia
% Posted @ DSPRelated.com
% in: http://www.dsprelated.com/showcode/10.php
function [y] = upsample2(x,N)
lx = length(x);
y = 0;
% Put first sample in the first position of the output
y(1) = x(1);
for i=2:lx
% Create a "chunk" (or piece) of vector, composed
% with a series of zeros and the next sample from
% the input
chunk = [zeros(1,N-1),x(i)];
% Append the chunk to the current output vector
y = [y,chunk];
end
```

## Comments:

There are no comments yet!

Sorry, you need javascript enabled to post any comments.