could you help me with this explanation?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
isilay aydin
el 19 de Mayo de 2020
Comentada: isilay aydin
el 19 de Mayo de 2020
OverallEffectinevess = (MassFlowFunction*ConvectionCoolingEfficiency)/(1 + MassFlowFunction*ConvectionCoolingEfficiency);
MetalTemperature = (ExternalGasTemperature) - OverallEffectinevess*(ExternalGasTemperature-CoolantInletTemperature);
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
0 comentarios
Respuesta aceptada
James Tursa
el 19 de Mayo de 2020
Editada: James Tursa
el 19 de Mayo de 2020
It's possible you just need to switch to element-wise operators. E.g.,
OverallEffectinevess = (MassFlowFunction.*ConvectionCoolingEfficiency)./(1 + MassFlowFunction.*ConvectionCoolingEfficiency);
MetalTemperature = (ExternalGasTemperature) - OverallEffectinevess.*(ExternalGasTemperature-CoolantInletTemperature);
What are the sizes of your variables?
3 comentarios
Walter Roberson
el 19 de Mayo de 2020
In MATLAB, C = A*B is algebraic matrix multiplication, also known as Inner Product.
C(I,J) = sum(A(I,:) .* B(:,J).')
In order for this to work, size(A,2) must be the same as size (B,1)
When you have A is a (10 x 1), B is a (10 x 1), then size(A,2) is 1, and size(B,1) is 10, and 1 is not equal to 10 so that is an error. You could have A*B' giving a 10 x 10 result, or you could have A'*B giving a 1 x 1 result, but not A*B .
If you want to multiple each element by its corresponding element, C(I,J) = A(I,J) * B(I,J) then you need the .* operator, MassFlowFunction.*ConvectionCoolingEfficiency not MassFlowFunction*ConvectionCoolingEfficiency
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal 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!