Matrix dimensions must agree error when using element operators
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Delonte Goodman
el 14 de Oct. de 2020
Respondida: Ameer Hamza
el 14 de Oct. de 2020
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);
0 comentarios
Respuesta aceptada
Ameer Hamza
el 14 de Oct. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!