Issue in term mismatch after finding roots
조회 수: 1 (최근 30일)
이전 댓글 표시
I aim having a mismatch error in the following code. The term1a works fine but I get no output from term1b, which I believe is causing my mismatch error. "In an assignment A(I) = B, the number of elements in B and I must be the same" referring to CB1(t)=Cb
while n<22
f=@(qn) tan(qn)-((3*qn./(3+alpha*(qn.^2))));
r= fzero(f,pi/2*[n n+2].*(1+100*eps*[1 -1]));
%term1=(6*alpha*(1+alpha)*exp(-Dall*(r.^2)*(t/(rS.^2))))/(9+9*(r.^2)*(alpha.^2));
term1a=(6*alpha*(1+alpha)*exp(-Dall1*(r.^2)*(t/(rS.^2))))/(9+9*(r.^2)*(alpha.^2))
term1b=((rS+.01)/rS)*(sin(qn.*rS./(rS+.01))/sin(qn))
term2=term2+term1a.*term1b;
n=n+2;
end
Cb1=(cAi/(1+alpha))*(1-term2);
CB1(t)=Cb1;
댓글 수: 0
채택된 답변
Roger Stafford
2014년 12월 17일
In the expression for 'term1b' you use the variable 'qn'. However, that appears to be the dummy argument for your function 'f'. Perhaps you need to replace that 'qn' with the root, 'r'.
Also you need to be sure that the variable 't' is a positive integer if it is to be used as an index in "CB1(t)=Cb1;".
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Analysis, Benchmarking, and Verification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!