Error using .* Matrix dimensions must agree. Error in eff_vs_length (line 20) Ty1=1-exp(​(-U.*AsurY​)./(m.*C)) >>

1 view (last 30 days)
L=9.512;
Y=0:9.512;
m=0.11;
C=1007;
D=0.18;
AsurL=pi*D*L;
AsurY=pi*D*Y;
r1=0.043;
r2=0.045;
r3=0.090;
Rc=1./(AsurL*h);
Rp=(ln((r2)/(r1))./(2*pi*L*Kp));
Rg=(ln((r3)/(r2))./(2*pi*L*Kg));
Rt=Rc+Rp+Rg;
U=1./Rt;
Tg=30;
Tair=25;
Ty1=1-exp((-U.*AsurY)./(m.*C))

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 21 Nov 2020
Edited: KALYAN ACHARJYA on 22 Nov 2020
Please define h,Kp and Kg
h=...?
Kp=..?
Kg=....? % Assumning all are scalar
%
L=9.512;
Y=0:9.512;
m=0.11;
C=1007;
D=0.18;
AsurL=pi*D*L;
AsurY=pi*D*Y;
r1=0.043;
r2=0.045;
r3=0.090;
Rc=1./(AsurL*h);
Rp=(log((r2)/(r1))/(2*pi*L*Kp));
Rg=(log((r3)/(r2))/(2*pi*L*Kg));
Rt=Rc+Rp+Rg;
U=1/Rt;
Tg=30;
Tair=25;
Ty1=1-exp((-U*AsurY)/(m*C))
  3 Comments
Image Analyst
Image Analyst on 21 Nov 2020
Why didn't you answer his question? Anyway, this runs without error for me:
h=1
Kp=1
Kg=1
L=9.512;
Y=0:9.512;
m=0.11;
C=1007;
D=0.18;
AsurL=pi*D*L;
AsurY=pi*D*Y;
r1=0.043;
r2=0.045;
r3=0.090;
Rc=1./(AsurL*h);
Rp=(log((r2)/(r1))./(2*pi*L*Kp));
Rg=(log((r3)/(r2))./(2*pi*L*Kg));
Rt=Rc+Rp+Rg;
U=1./Rt;
Tg=30;
Tair=25;
Ty1=1-exp((-U.*AsurY)./(m.*C))
Besides, there are no matrices or vectors even IN your code so the error you gave could not possibly occur with that code. Everything inside parentheses is a constant and that constant is not being used as an index to any array. log() and exp() are functions, unless you defined then elsewhere (in another m-file or on the command line) to be arrays and overwrote the original functions that they are.
KALYAN ACHARJYA
KALYAN ACHARJYA on 22 Nov 2020
@Image Analyst, Sorry sir, I missed the title of the question. Thank you for your detailed comment.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!