How can I do an integral of a composite function

4 views (last 30 days)
Hi everybody,
I'm a beginner, so sorry for my trivial question. I would like to integrate (with trapezi method) in w (symbolic variable) a function that depends on w and on other functions of w. I try to put @(w) before the expressions, but it doesn't work.
It returns to me these errors:
Error using mupadmex Error in MuPAD command: Index exceeds matrix dimensions.
Error in sym/subsref (line 1580) B = mupadmex('symobj::subsref',A.s,inds{:});
This is the code:
syms w
sigmatot_1= iphon^2.*w.^2.*gammaph./((w.^2-wph^2).^2+gammaph^2.*w.^2)./(60);
sigmatot_2= iphon^2.*w.*(w.^2-wph^2)./((w.^2-wph^2).^2+gammaph^2.*w.^2)/60;
k=sqrt(1/2*sqrt((1-60.*sigmatot_2./w).^2+(60.*sigmatot_1./w).^2)-1/2+30*sigmatot_2./w); n=sqrt(1/2*sqrt((1-60.*sigmatot_2./w).^2+(60.*sigmatot_1./w).^2)+1/2-30*sigmatot_2./w);
Equadr_sample=(abs((exp(-w.^2/(2*sigma^2)))*2./(1+(n+1i.*k)).*exp(-1i.*w.*1.2*10^-5.*(n+1i*k)./c).*2.*(n+1i.*k)./((n+1i.*k)+ns).*exp(-1i.*w.*5*10^-2*ns./c))).^2;
num=trapezi(@(w) Equadr_sample,18, 82.5, 1000);

Answers (0)

Categories

Find more on Symbolic Math Toolbox 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!