Inserting space between values in vector
5 次查看(过去 30 天)
显示 更早的评论
Hi,
Say I have a vector x = [1 2 3 4] How can I make it x1 = [1 0 2 0 3 0 4 0]
Thank you!!
0 个评论
采纳的回答
Wayne King
2012-8-16
编辑:Wayne King
2012-8-16
Do you have the Signal Processing Toolbox?
x = [1 2 3 4];
x = upsample(x,2);
If not
x = 1:4;
y = zeros(2*length(x),1);
y(1:2:end) = x;
If you have the Wavelet Toolbox
x = 1:4;
y = dyadup(x,0);
1 个评论
Matt Fig
2012-8-16
I learn something new everyday. I didn't know there was a function to do this! Thanks, Wayne.
更多回答(1 个)
per isakson
2012-8-16
编辑:per isakson
2012-8-16
One more way to do it
x = 1:4;
x1 = cat( 1, x, zeros(size(x)) );
x1 = transpose(x1(:));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time-Frequency Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!