summation of aij & i, j dependent function in matlab
조회 수: 1 (최근 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
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
채택된 답변
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
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!