What is the matrix code for column vectors
1 回表示 (過去 30 日間)
古いコメントを表示
You have two variables u, v and you calculate the shape using the size command:
>> size(u) ans = 1 3 >> size(v) ans = 3 1 I want a matrix with 3 columns, the vectors u and v in the first two, and their sum in the third.
0 件のコメント
回答 (2 件)
dbmn
2017 年 7 月 14 日
This should do the trick using the ' for transpose
new_matrix = [u', v', (u+v)']
2 件のコメント
Jan
2017 年 7 月 14 日
@Meenakshi S: Please do not let us guess. Does "not accept" means, that you get an error message? If so, please post it here. It is much easier to fix an error than to guess, what the error is.
Many readers of the forum are not native English speakers. Then kewl abbrevs makes it harder to read your messages.
C.J. Harris
2017 年 7 月 14 日
There are a few ways to do this, for example:
x = [u' v (u' + v)]
The apostrophe can be used to transpose a matrix. You could also use the 'reshape' command.
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!