Matrix dimensions must agree error when using element operators

15 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by