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!