getting error "unable to convert expression in to double array" while using int for symbolic expressions.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am calculating this integration but finding error.
The expression for the refrence is following:
OS = int((int((beta.*(1./sqrt(2.*pi)).*besselj(1,(3.8317)*R)),R)),R,[0,10e-9])
beta is some finite constant.
1 comentario
Walter Roberson
el 15 de Sept. de 2023
syms beta R
OS = int((int((beta.*(1./sqrt(2.*pi)).*besselj(1,(3.8317)*R)),R)),R,[0,10e-9])
vpa(OS)
If beta were a symbolic variable at that point then double(OS) would fail because double() would not be able to convert the symbolic variable that had no definition. But if beta had a specific numeric value before the calculation was run, then double() should be able to process it.
Respuestas (1)
Chetan
el 15 de Sept. de 2023
Editada: Chetan
el 15 de Sept. de 2023
It seems that you are encountering an issue while working with symbolic variables and receiving an error.
To perform symbolic integration, you need to utilize the "int" function from the Symbolic Math Toolbox.
Here's an example of how you can perform symbolic integration for the expression you provided:
syms R beta
OS = int(int(beta*(1/sqrt(2*pi))*besselj(1,3.8317*R), R), R, [0, 10e-9]);
Make sure you have the Symbolic Math Toolbox installed and loaded in MATLAB to perform symbolic computations.
For more details about “syms” function refer to the following article:
I hope these suggestions help you resolve the issue you are facing.
1 comentario
Walter Roberson
el 15 de Sept. de 2023
This error occurs because the "int" function in MATLAB is designed for numerical integration and cannot directly handle symbolic expressions.
Incorrect. There is no numeric integration function named int. int is only for sym and symfun and maybe symmatrix
Ver también
Categorías
Más información sobre Assumptions 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!