symbolic Integration results showing large unsolved values with a function multiplied on which integration has been done
2 views (last 30 days)
Show older comments
symbolic Integration results showing large unsolved values multiplied with a function on which integration has been done.how can one obtain matrix after symbolic numerical integration without symbolic representation of matrix elements.
1 Comment
Walter Roberson
on 24 Feb 2022
Could you give us an example, and an more detailed description of what you would like to have happen instead?
.. Are you just looking for vpa() to convert rational values to floating point?
Answers (1)
Shivam
on 12 Jan 2024
Hi Subho,
Based on the information you shared, I understand that while dealing with symbolic integration in MATLAB, it results in large unresolved expressions and you want to perform numerical integration on a matrix without retaining the symbolic representation of the matrix elements.
You can utilize MATLAB's 'vpaintegral' and 'integral' functions to achieve the desired numerical integration on a matrix. You can follow the below workaround for a 1x2 matrix with integration limits from 0 to pi/2:
% Define the symbolic variable
syms x;
% Define the functions in a cell array/matrix
f = {sin(x) * exp(-x), sin(-x) * exp(x)}
% Define integration limits
a = 0;
b = pi/2;
% Numerical integration using vpaintegral for symbolic expressions
vpaIntMat = {vpaintegral(f{1}, a, b), vpaintegral(f{2}, a, b)}
% Convert symbolic expressions to MATLAB functions
F = {matlabFunction(f{1}), matlabFunction(f{2})}
% Numerical integration using integral for MATLAB functions
intMat = {integral(F{1}, a, b), integral(F{2}, a, b)}
You can refer to the following documentation links to know more about the 'vpaintegral' and 'integral' functions, as well as methods for integrating without using symbolic representation:
- https://www.mathworks.com/help/releases/R2023b/symbolic/sym.vpaintegral.html
- https://www.mathworks.com/help/releases/R2023b/matlab/ref/integral.html
- https://www.mathworks.com/matlabcentral/answers/693410-integrating-without-using-the-symbolic-toolbox
I hope it helps.
Thanks
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!