Problem with creating matrix
1 次查看(过去 30 天)
显示 更早的评论
I'm trying to create a 36x36 matrix where each column has two 18x1 vectors stacked. The vectors correspond to deflections in both the y and z direction and were calculated by setting the loads in the y direction (1st potition) as a 1x18 vector where the first value is 1 and others zero ([1 0 0 0 0 ..]), the loads in the z direction were set all to zero with the same vector length.
For the second column of the matrix, the deflection in the y and z direction must be calculated by setting the loads in the z direction(still 1st position) as [0 1 0 0 0 ..] with the same 1x18 length, and the loads in the y direction were all zero.
The deflections in y and z are inside a for loop with 18 positions.
For the third column of the matrix, I need the deflections in y and z but setting the loads in the y direction(now 2nd position) to [0 0 1 0 0 ...] and the loads in z as zero. The forth column would correspond to the loads in the z directions as [0 0 0 1 0 0 ..] and loads in y zero.
Is there a way I could create this matrix with a for loop that changes where the value of "1" in the vectors for the loads is located? I'm trying to solve a vibrations problem involving a flexibility matrix
5 个评论
dpb
2020-11-27
What's so hard to just show a small example???
Is the following the pattern you for a 4-element case instead of 18?
M=[1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1];
?
It's two identity matrices except with alternate 0 columns in the two halves?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!