formation of a function like in Mathematica
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, I am new user in Matlab, My question is that how can i form a function in editor file like we can make in Mathematica like
F[n_] := ComplexExpand[Im[etp[n]/(et[n] - (x + y I))]]
Also Is there any equivalent command for
ComplexExpand
in Matlab? Thanks
1 件のコメント
hparacha777
2015 年 8 月 6 日
編集済み: hparacha777
2015 年 8 月 6 日
Hi, you can write the function in Matlab Editor as:
function [out1, out2, ...] = myfun(in1, in2, ...)
Just save the file with the name of the function. Hope it helps.
回答 (1 件)
Walter Roberson
2015 年 8 月 5 日
f = @(n) ComplexExpand(imag(etp(n)/(et(n) - (x + y * i))))
however, ComplexExpand, etp, and et are not defined for MATLAB.
Mathematica's ComplexExpand is a non-trivial symbolic process so to get it right you would need to be working with the Symbolic Toolbox. At the moment I do not see an equivalent routine in the Symbolic Toolbox. In the programming language Maple that the Symbolic Toolbox has many similarities to, the routine would be named evalc(), but MATLAB'S evalc() has nothing to do with that.
7 件のコメント
Walter Roberson
2015 年 8 月 6 日
You are not likely to get those any time soon. MATLAB has a limited interface subset to the Symbolic Toolbox ('MuPAD') which is more powerful.
I was assisting you under the assumption that you wanted to make something work. The primary barrier to making something work is the definition of et and etp as objects that need to recognize two specific inputs and return specific arbitrary outputs for those two inputs while being meaningfully defined symbolically for the formula with indefinite n.
参考
カテゴリ
Help Center および File Exchange で Number Theory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!