Issue in term mismatch after finding roots
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Melissa
il 17 Dic 2014
Risposto: Roger Stafford
il 17 Dic 2014
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 Commenti
Risposta accettata
Roger Stafford
il 17 Dic 2014
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Analysis, Benchmarking, and Verification in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!