# getting error "unable to convert expression in to double array" while using int for symbolic expressions.

2 views (last 30 days)
pooja sudha on 2 Mar 2022
Commented: Walter Roberson on 15 Sep 2023
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.
Walter Roberson on 15 Sep 2023
syms beta R
OS = int((int((beta.*(1./sqrt(2.*pi)).*besselj(1,(3.8317)*R)),R)),R,[0,10e-9])
OS =
vpa(OS)
ans =
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.

Chetan on 15 Sep 2023
Edited: Chetan on 15 Sep 2023
Hello @pooja sudha,
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.
Walter Roberson on 15 Sep 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