# Upsampling data

## Description

Upsampling is the process of increasing the sampling rate of a signal. Upsample increases the sampling rate of the input AOs by an integer factor. LTPDA upsample overloads upsample function from Matlab Signal Processing Toolbox. This function increases the sampling rate of a signal by inserting (n-1) zeros between samples. The upsampled output has (n*input) samples. In addition, an initial phase can be specified and, thus, a delayed output of the input can be obtained by using this option.

## Syntax

```
b = upsample(a, pl)
```

## Parameters

The following parameters can be set in this method:

• N - specify the desired upsample rate
• phase - specify an initial phase range [0, N-1]

## Examples

1. Upsampling a sequence of random data at original sampling rate of 1 Hz by a factor of 10 with no initial phase.

```
pl    = plist('tsfcn', 'randn(size(t))','fs',1,'yunits','m','nsecs',100);
x     = ao(pl);
pl_up = plist('N', 10);     % increase the sampling frequency by a factor of 10
y     = upsample(x, pl_up); % resample the input AO (x) to obtain the upsampled AO (y)
iplot(x, y)
```

2. Upsampling a sequence of random data at original sampling rate of 1 Hz by a factor of 21 with a phase of 20 samples.

```
pl         = plist('tsfcn', 'randn(size(t))','fs',1,'yunits','m','nsecs',100);
x          = ao(pl);
pl_upphase = plist('N', 21,'phase', 20); % increase the sampling frequency and add phase of 20 samples to upsampled data
y          = upsample(x, pl_upphase);    % resample the input AO (x) to obtain the upsampled and delayed AO (y)
iplot(x, y)
```