フィルターのクリア

I am having trouble adding [a]+[b].

2 ビュー (過去 30 日間)
Emily Gobreski
Emily Gobreski 2016 年 6 月 12 日
コメント済み: Emily Gobreski 2016 年 6 月 12 日
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 件のコメント
Roger Stafford
Roger Stafford 2016 年 6 月 12 日
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.
Emily Gobreski
Emily Gobreski 2016 年 6 月 12 日
Thank so much for your help. I really appreciate it!

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2016 年 6 月 12 日
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 件のコメント
Emily Gobreski
Emily Gobreski 2016 年 6 月 12 日
Great! Thank you so much for your help! I really appreciate it.
Star Strider
Star Strider 2016 年 6 月 12 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by