symbolic Integration results showing large unsolved values with a function multiplied on which integration has been done
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2022 年 2 月 24 日
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?
回答 (1 件)
Shivam
2024 年 1 月 12 日
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 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!