For example, if my vector is: [2], I'd like to convert this into:
[1,n]. Then, if input is:[3] -> [1,n,n^2] and so on...

 採用された回答

John D'Errico
John D'Errico 2018 年 10 月 6 日

0 投票

inp = 3;
syms n
n.^(0:inp-1)
ans =
[ 1, n, n^2]

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Data Type Conversion についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by