Double integration in matlab

조회 수: 5 (최근 30일)
AVM
AVM 2020년 3월 5일
댓글: AVM 2020년 3월 5일
I would like to double integrate the following code, but some error is happenig. Pl somebody help me.
clc;
clear;
syms r1 theta1 n1 m1
r2=1.0;
theta2=2.0;
alpha1=0.5;
alpha2=1.0;
lambda=2.0;
omega=1;
phi=pi/3;
mu=cosh(r2);
nu=exp(1i*theta2).*sinh(r2);
beta1=r1.*exp(1i*theta1);
f1=exp(-((alpha1).^2)-((alpha2).^2)-((abs(beta1)).^2)-(1/mu).*real(((alpha2).^2)*conj(nu)));
f2=@(n1,m1)(((alpha1*conj(beta1))^(n1))./factorial(n1))*(((conj(alpha1)*(beta1))^(m1))/factorial(m1));
f3=1./sqrt((((mu).^2)-(abs(nu)).^2));
f4= exp((((1/mu).*real(((alpha2).^2)*conj(nu)))+(((alpha2).^2)))./((((mu).^2)-(abs(nu)).^2)));
Q1=(1/pi)*f1.*f3.*f4.*symsum(symsum(f2,n1,0,20),m1,0,20);
a1=@(r1,theta1)(1/2).*((beta1).*exp(-1i*phi)+conj(beta1).*exp(1i*phi)).*Q1;
a2=@(r1,theta1)(1/4)*(((beta1).^2)*exp(-2*1i*phi)+((conj(beta1)).^2)*exp(2*1i*phi)+(2*(abs(beta1)).^2)-1).*Q1;
x1=integral2(a1,0,10,0,2*pi)
x2=integral2(a2,0,10,0,2*pi)
Error using integral2Calc>integral2t/tensor (line 231)
Input function must return 'double' or 'single' values. Found 'sym'.

답변 (1개)

Steven Lord
Steven Lord 2020년 3월 5일
Dont use integral or integral2 to integrate a symbolic function. Use one of the symbolic integration functions listed on this documentation page or use the matlabFunction function to create a numeric function suitable for use with integral or integral2 as per the examples on this documentation page.
  댓글 수: 1
AVM
AVM 2020년 3월 5일
Thanks. Then can I use
int(int(fun,r1,0,10),theta1,0,2*pi) % for double integration?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by