summation of aij & i, j dependent function in matlab

2 次查看(过去 30 天)
Hello, I am trying to create a code that can calculate the local resistance coefficient via formula above. the values of ai and aij are defined.
I have created a code using for loops, but getting a really high number.
I have defined example values for Re, f0, and f1 values below. Using the published graph, I should be getting around 1-1.1
ai and bi are values defined.
Please forgive me, it might be that I got matrix algebra incorrect, as I am thinking that might be the suspicion but not sure what I need to change at this point.
Thank you.
%
% initial contraction from flow, formula from diagram 4.10
%
%
%given test values
Re_0=60.46;
f0=1;
f1=2.7225;
%
ind=8;
acoeff=0;
ai=[-25.12458,18.5076,-170.4147,118.1949,-44.42141,9.09524,-.9244027,.03408265];
for i = 1:ind
acoeff=acoeff+ai(i)*log(Re_0)^i;
end
acoeff
acoeff = -1.6830e+03
bi=[1.07 1.22 2.933;.05 -.51668 .8333; 0 0 0];
iB=3;
jB=3;
count=0;
B_inner=0;
Bcoeff=0;
for i=1:iB
for j=1:jB
B_inner=B_inner+bi(i,j)*((f0/f1)^j);
end
Bcoeff=Bcoeff+B_inner*log(Re_0)^i;
end
Coeff_local=(acoeff*Bcoeff)*(1-f0/f1)
Coeff_local = -6.6410e+04

采纳的回答

VBBV
VBBV 2024-4-22
编辑:VBBV 2024-4-22
%
% initial contraction from flow, formula from diagram 4.10
%
%
%given test values
Re_0=60.46;
f0=1;
f1=2.7225;
%
ind=8;
acoeff=0;
ai=[-25.12458,118.5076,-170.4147,118.1949,-44.42141,9.09524,-.9244027,.03408265];
for i = 0:ind-1
acoeff=acoeff+ai(i+1)*log(Re_0)^i;
end
acoeff
acoeff = -0.0814
bi=[1.07 1.22 2.933;.05 -.51668 .8333; 0 0 0];
iB=3;
jB=3;
count=0;
B_inner=0;
Bcoeff=0;
for i=0:iB-1
for j=0:jB-1
B_inner=B_inner+bi(i+1,j+1)*((f0/f1)^j);
end
Bcoeff=Bcoeff+B_inner*log(Re_0)^i;
end
Coeff_local=(acoeff*Bcoeff)*(1-f0/f1)
Coeff_local = -2.1331
  8 个评论
VBBV
VBBV 2024-4-22
编辑:VBBV 2024-4-22
@BenK that value is natural log to decimal log conversion factor. since acoeff and Bcoeff are computed separately involving log function it needs to be used twice
BenK
BenK 2024-4-22
Thank you for helping me with this issue. I will mark this as resolved

请先登录,再进行评论。

更多回答(0 个)

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by