ベクトルを補間したい
显示 更早的评论
例えば、
X=[3 5 1]
を、次のように3倍に増やしたい
Y=[3 3 3 5 5 5 1 1 1]
これを、任意のXについて、任意の倍率で行う演算を、素早く実施したく、教えて下さい。
for文を多用すれば、できることは、わかっています。
回答(3 个)
Shunichi Kusano
2022-8-26
1 个投票
実はrepelemという関数がありまして、それだと1行でできます。
Genki Uebayashi
2022-8-26
0 个投票
repmatで3行に増やして、reshapeで1行numel列に並び替えでできます。
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!