y = upsample(x,n)
increases the sample rate of x by inserting
n – 1 zeros between samples. If x is a
matrix, the function treats each column as a separate sequence.
Generate a 101-second sine waveform with a fundamental frequency of 0.01 Hz and a space of 5 seconds between consecutive samples.
ts = 5;
tx = (1:ts:101)';
x = sin(2*pi*0.01*tx);
Upsample the signal using an upsampling factor of 3. Compare the original and upsampled signals. To produce the upsampled signal, the upsample function inserts two zeros between sine samples.
n = 3;
ty = (1:ts/n:ts*numel(x))';
y = upsample(x,n);
plot(tx,x,"o",ty,y,".")
legend(["Original""Upsampled"])
Upsample the signal using an upsampling factor of 3 and a phase offset of 1. Compare the original and upsampled signals. Because of the specified phase offset, the first sample of the original signal matches with the second sample on the upsampled signal.
p = 1;
ty = (1:ts/n:ts*numel(x))';
y = upsample(x,n,p);
plot(ts/n*p+tx,x,"o",ty,y,".")
legend(["Original""Upsampled"])
Upsampled array, returned as a vector or matrix. y
has x × n samples.
Tip
To remove the imaging artifacts from the upsampled output
y, apply a lowpass filter to
y with cutoff normalized frequency of
pi/n rad/sample.
Alternatively, use the interp function.
The upsample function supports code generation for
graphical processing units (GPUs). You must have MATLAB®
Coder™ and GPU Coder™ to generate CUDA® code.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.