Hi,
I would like to define one function with 2 variables, then to integrate it. As it is a long expression, I divided it into other functions.
C=etar*etap*Pp/(h*c/lambdap)*2*alpha/(pi*wp^2);Rp=@(r,z)C*exp(-2*r*r/(wp*wp))*exp(-alpha*z);zR=pi*w0^2/lambda;w=@(z)w0*sqrt(1+(z/zR)^2);Ne=@(r,z)Rp(r,z)*Tau;Ng=@(r,z)Nt-Rp(r,z)*Tau;BetaS=@(r,z)(Ne(r,z)-Ng(r,z))/(Ne(r,z)+Ng(r,z));integrd1=@(r,z)BetaS(r,z)*exp(-2*r*r/(w(z)*w(z)))*r;integrd2=@(r,z)exp(-2*r*r/(w(z)*w(z)))*r;BetaSAv=dblquad(integrd1,0,Inf,0,lc)/dblquad(integrd2,0,Inf,0,lc);
All the constants are defined before. I have then the error message:
??? Error using ==> mtimesInner matrix dimensions must agree.Error in ==> BetaSAvCalc2>@(r,z)C*exp(-2*r*r/(wp*wp))*exp(-alpha*z) at 28 Rp=@(r,z)C*exp(-2*r*r/(wp*wp))*exp(-alpha*z);
The error message continue with all lines which have a failure. Could you please help me to understand what is wrong ? Thanks in advance !
Best Answer