Integrating with trapz and int
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
John D'Errico
el 28 de Dic. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!