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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.