could you help me with this explanation?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
James Tursa
2020 年 5 月 19 日
編集済み: James Tursa
2020 年 5 月 19 日
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 件のコメント
Walter Roberson
2020 年 5 月 19 日
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!