필터 지우기
필터 지우기

Integrating with trapz and int

조회 수: 1 (최근 30일)
Nico Pisani
Nico Pisani 2020년 12월 28일
댓글: John D'Errico 2020년 12월 28일
Hi All.
I have the following code
syms theta
B=dlmread('630nm in ARF E_y cartesian coordinates.txt')
B1new = B(:,1)
B2new=B(:,2)
alpha=sqrt(B2new.^2+B1new.^2)
BS=[alpha]
CS=[conj(B(:,3))]
k=2.*pi./(630.*0.000000001)
bess=[besselj(0,k.*BS.*sin(theta)).*tan(theta).*CS.*BS]
U=trapz(bess)
Bessint = int(U,theta,[0 0.6])
Fvpa = vpa(Bessint)
for calculating the following integral
CS, BS correspond respectively to \rho and E*(\pho) which are extracted from a .txt file.
The code has calculated symbolically U but after hours running it has not completed the Fvpa quantity calculation yet (editor reports "busy" status).
Matrices at stake are quite big (~40000 ins column)
May anyone help me please?
  댓글 수: 1
John D'Errico
John D'Errico 2020년 12월 28일
Get a faster computer. Use smaller matrices, solve smaller problems. Get some coffee, read a book while you wait (something long, and preferably about numerical methods in MATLAB.) Or, ... write better code.
Note that it is rarely a good idea to use trapz AND int in the same code. trapz being a numerical integration method with relatively low accuracy makes little sense in conjunction with a symbolic tool.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by