MeijerG function using MATLAB's symbolic toolbox
10 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2016-7-15
编辑: MathWorks Support Team
2025-1-19
I want to know whether there is anyway I can use MeijerG functions in Matlab scripts using symbolic toolbox. Specifically, MeijerG functions describe the probability densities and it is easier to work with them. Currently, I use Maple to get the results and then retype them in Matlab. But, I am unable to use them in symbolic toolbox
采纳的回答
MathWorks Support Team
2025-1-19
编辑:MathWorks Support Team
2025-1-19
As of R2017b, the function "meijerG" calculates the Meijer G-Function. This function can return either numerical values or symbolic expressions for the Meijer G-Function depending upon the input.
For 'double' inputs, "meijerG" returns a double, as shown below:
>> meijerG(3, [], [], [], 3)
ans =
6.4488
For 'sym' inputs, "meijerG" will return an exact symbolic answer whenever possible. An example is shown below:
>> meijerG(sym(2/5), [], sym(1/2), [], sym(3))
ans =
(2^(4/5)*3^(1/2)*gamma(1/10))/80
The documentation linked below has more details about "meijerG"'s full functionality:
For prior releases, the symbolic MeijerG function is only available in MuPAD. From MATLAB, it must be evaluated using "evalin", as shown below:
>> y=evalin(symengine, 'simplify(meijerG([[3],[]], [[],[]],3))');
y =
9*exp(-1/3)
Once this command executes, 'y' will contain symbolic MeijerG function for given arguments.
Note that without the call to "simplify", an expression in terms of the MuPAD function "meijerG" may be returned, which will not be understood by MATLAB in further function calls. You can pass this back to "evalin" by first converting it with the "char" function, but this workflow is not recommended.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!