I receive different output to like input
3 次查看(过去 30 天)
显示 更早的评论
why is there diffrent in the outputs?
1 个评论
Gautam Chettiar
2022-11-1
v' is the transpose, and when you are adding two 1-D arrays which have different dimensions, here of (1,5) and (5,1), MATLAB automatically casts a broadcasted matrix addition, hence both of matrices get converted to (5,5) dimension form with repeating columns and rows respectively. The output is exactly what it should be.
采纳的回答
Voss
2022-11-1
0:4+5*(0:4)' is the same as 0:(4+5*(0:4)')
0:(4+5*(0:4)')
v+5*v', where v is 0:4, is the same as (0:4)+5*(0:4)'
v = 0:4;
v+5*v'
(0:4)+5*(0:4)'
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!