I am having trouble adding [a]+[b].
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Emily Gobreski
le 12 Juin 2016
Commenté : Emily Gobreski
le 12 Juin 2016
theta=30
Sign=(cosd (theta)/abs (cosd (theta)))
U=.8
R=12
C=5
a=[1 0 1 0 0 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0 0 0; 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0 0 1; 0 0 0 0 1 0 1 0 0 0 0; 0 0 0 0 0 1 0 1 0 0 0; 0 0 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0; 0 0 -1 0 -1 0 0 0 (4*abs (sign)) 0 0; 0 0 0 -1 0 -1 0 0 (-4*u*sign) 0 0; 0 0 -c (3*R) -c (-3*R) 0 0 (-4*(y-c)) 0 0; 0 0 0 0 0 0 0 0 (-u*sign) 1 0]
b=[Ax; Ay; Bx; By;Cx; Cy; Dx; Dy; NB; Nc; T]
a+b=
4 commentaires
Roger Stafford
le 12 Juin 2016
If the quantities Ax, Ay, Bx, etc. are each scalar numbers, the most serious problem you have is that the two arrays you are attempting to add have different sizes. The ‘a’ array is of size 10-by-11 and the ‘b’ array would be of size 11-by-1. You need to figure your way out of that problem - what are you adding to what? If you do repmat(b,1,10).’, then you could add them (note the transpose operator.) Instead of that you could use the ‘bsxfun’ along with a transpose.
Réponse acceptée
Star Strider
le 12 Juin 2016
MATLAB is case-sensitive, so sign~=Sign and so for the rest. I corrected as many of those as I could find. We also don’t have ‘y’:
a=[1 0 1 0 0 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0 0 0; 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0 0 1; 0 0 0 0 1 0 1 0 0 0 0; 0 0 0 0 0 1 0 1 0 0 0; 0 0 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0; 0 0 -1 0 -1 0 0 0 (4*abs ( Sign)) 0 0; 0 0 0 -1 0 -1 0 0 (-4*U*Sign) 0 0; 0 0 -C (3*R) -C (-3*R) 0 0 (-4*(y-C)) 0 0; 0 0 0 0 0 0 0 0 (-U*Sign) 1 0];
Supply ‘y’ and that assignment may work. I don’t know what you’re doing with ‘b’, and we don’t have any of its elements, so I don’t know if you can do the addition.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!