could you help me with this explanation?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
isilay aydin
le 19 Mai 2020
Commenté : isilay aydin
le 19 Mai 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 commentaires
Réponse acceptée
James Tursa
le 19 Mai 2020
Modifié(e) : James Tursa
le 19 Mai 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 commentaires
Walter Roberson
le 19 Mai 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!