Inner matrix dimensions must agree

Dear All Can anyone help me about this equation Qb=Qba*(1-(0.3251).^2)+4*(0.985)*(5.67*10.^-8)*(TS).^3*(TT); When i run it , I get this error Error using * Inner matrix dimensions must agree. where Qba [37*37 double] TS[37*1 double] TT [37*31 double] Thank All

回答 (2 件)

Jan
Jan 2016 年 11 月 14 日

0 投票

As you see, you want to multiply a [71x1] vector with a [37x31] matrix. This is mathematically not defined. What do you expect as output?

3 件のコメント

b.m.n n
b.m.n n 2016 年 11 月 15 日
編集済み: Jan 2016 年 11 月 15 日
Thank you for help ... but I did some change in TT [37*1] and TS [73*1] to get the same size .. still show the same error in left term
Jan
Jan 2016 年 11 月 15 日
Of course it shows the same error for a [37x1] and [73x1] matrix. A valid Matrix multiplication would be: [1x37] and [37x1]. Please ask e.g. WikiPedia for the term "matrix multiplication".
b.m.n n
b.m.n n 2016 年 11 月 16 日
Thank you so much Jan Simon

サインインしてコメントする。

Alexandra Harkai
Alexandra Harkai 2016 年 11 月 14 日

0 投票

4*(0.985)*(5.67*10.^-8)*(TS).^3*(TT)
Here according to the operator precedence this happens:
(some_constant * (TS.^3)) * TT
which would require a matrix of 37x1 to be multiplied by a matrix of size 37x31, which is giving you the error.
It is possible the calculation is not formulated correctly in the first place.

6 件のコメント

b.m.n n
b.m.n n 2016 年 11 月 15 日
Thank you for help ... but I did some change in TT [37*1] and TS [73*1] to get the seam siez .. still show the same error in left term
Alexandra Harkai
Alexandra Harkai 2016 年 11 月 15 日
What are the current sizes?
b.m.n n
b.m.n n 2016 年 11 月 15 日
%long Wave Radition.(W/m2)(Qb)
%Qb=Qbo(1-cn^2)*4*epsilon*sigma*Ts.^3(TS-TA)
%==>Qba=(epsilon*sigma*(To^4))*(0.39-0.05*(Sqrt(P)));
% epsilon=0.985;
% sigma=(5.67*10^-8 );%Wm^(-2) K^(-4) the Stefan–Boltzmann constant
% The Constants a and b(0.39-0.05)
%Ts=sea surface temperature[K]
%Ta=air temperature[K]
%___________________________
%Desemper_Temp
Ts=TEMP_DEC_S;%[C] [ 37x1 ]
Ta=TempDryAvg(784-2:814-2);%[c] [31x1]
%K=C+273.15
TS=Ts+273.15; %[37x1]
TA=Ta+273.15; %[31x1]
%___________________________
%Vapor Pressure of Water calculator Formula
%P=10^(A_B/(C+T))
%Where:
%P: Vapor Pressure of Water
%T: Water Temperature, in Celsius
%A,B,C: Antoine Constants for Water.
%When water temperature in the range of 1 - 100 Celsius
A=8.07131;
B=1730.63;
C= 233.426;
ea=10.^(A-B/(C+Ts)); %[1x37]
%==>Qba=(epsilon*sigma*(To^4))*(0.39-0.05*(Sqrt(ea)));
Qba=(0.985*5.67*10.^-8*(TS.^4))*(0.39-0.05*(sqrt(ea)));%[37x37]
Qb=Qba*(1-(0.3251).^2)+4*(0.985)*(5.67*10.^-8)*(TS.^3)*(TA-TS);
%%%%%%%%%%%%%%%%%%%
% to get seam size (TA)
Taa=ones(37,1)*nan;%a new matrix
s=37;%number of ROW
for i=1:s
TA(i,:)=Taa(i,:)+1;
end
Alexandra Harkai
Alexandra Harkai 2016 年 11 月 15 日
In this case,
TA-TS
would not even work because TA and TS have different sizes and none of them is a scalar.
What is the computation you want to implement there?
b.m.n n
b.m.n n 2016 年 11 月 16 日
Thank you so much..Alexandra ..I want to get same size for TA and TS .But i don't now how .
Alexandra Harkai
Alexandra Harkai 2016 年 11 月 16 日
It is not exactly clear what you are tying to achieve. Depending on what the vectors represent, the operation may not even make sense. Are you sure this is the computation you need?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

質問済み:

2016 年 11 月 14 日

コメント済み:

2016 年 11 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by