Matrix dimensions must agree error when using element operators

15 ビュー (過去 30 日間)
Delonte Goodman
Delonte Goodman 2020 年 10 月 14 日
回答済み: Ameer Hamza 2020 年 10 月 14 日
I am confused on why I keep getting the error "Matrix dimensions must agree.". I am using element operators for the variable s_g=1.21.*WS./(g*rho.*TW).
C_Lmax=1.7;
g=32.2; % ft/s^2 %
rho=0.002377; % slugs/ft^3 %
% vectors %
TW=0.25:0.01:0.60;
WS=40:1:120;
% Matrices %
TWmat=meshgrid(0.25:0.01:0.60);
WSmat=meshgrid(40:1:120);
SGmat=meshgrid(TWMat,WSMat);
s_g=1.21.*WS./(g*rho.*TW);

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 14 日
Your variables
TW=0.25:0.01:0.60;
WS=40:1:120;
have a different number of elements. The element-wise operators require that all the vectors have equal length.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by