Matrix dimensions must agree error when using element operators

14 views (last 30 days)
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);

Accepted Answer

Ameer Hamza
Ameer Hamza on 14 Oct 2020
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.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!