Problem with creating matrix
Afficher commentaires plus anciens
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 commentaires
dpb
le 27 Nov 2020
Most difficult to try to parse verbal description -- give a small example of the desired pattern.
If you can compute the wanted vectors as implied, you can certainly put them together -- just have to have the rule by which to do so.
Maria Sarcos
le 27 Nov 2020
dpb
le 27 Nov 2020
That takes a lot of delving into to decipher still -- just gives us a small example of the form
Maria Sarcos
le 27 Nov 2020
dpb
le 27 Nov 2020
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?
Réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
