formation of a function like in Mathematica

2 Ansichten (letzte 30 Tage)
Kashif
Kashif am 5 Aug. 2015
Kommentiert: Kashif am 8 Aug. 2015
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 Kommentar
hparacha777
hparacha777 am 6 Aug. 2015
Bearbeitet: hparacha777 am 6 Aug. 2015
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 5 Aug. 2015
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 Kommentare
Walter Roberson
Walter Roberson am 6 Aug. 2015
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.
Kashif
Kashif am 8 Aug. 2015
ok Sir , Thanks a lot for your time, i will try it

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by