Effacer les filtres
Effacer les filtres

Integrating with trapz and int

1 vue (au cours des 30 derniers jours)
Nico Pisani
Nico Pisani le 28 Déc 2020
Commenté : John D'Errico le 28 Déc 2020
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 commentaire
John D'Errico
John D'Errico le 28 Déc 2020
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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by