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?
%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
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 Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

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