summation of aij & i, j dependent function in matlab
1 view (last 30 days)
Show older comments
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
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)
0 Comments
Accepted Answer
VBBV
on 22 Apr 2024
Edited: VBBV
on 22 Apr 2024
%
% 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
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)
8 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!