create a matrix from a matrix x=[-2 -1 0 1 2]; which follow quadratic equations
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone, i want to create a matrix from this matrix x=[-2 -1 0 1 2] in such a way that resultant matrix is [ (-2^2),(-2^1),(-2^0); (-1^2),(-1^1),(-1^0); (0^2),(0^1),(0^0); (1^2),(1^1),(1^0); (2^2),2^1),(2^0) ]
0 个评论
采纳的回答
更多回答(1 个)
Andrei Bobrov
2016-11-30
编辑:Andrei Bobrov
2016-11-30
x = [-2 -1 0 1 2];
out = x(:).^(2:-1:0); % for R2016b
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!