Filter löschen
Filter löschen

Integrating with trapz and int

1 Ansicht (letzte 30 Tage)
Nico Pisani
Nico Pisani am 28 Dez. 2020
Kommentiert: John D'Errico am 28 Dez. 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 Kommentar
John D'Errico
John D'Errico am 28 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by