Message Boards Message Boards


How do the same function in Mathematica?

Posted 9 years ago
0 Replies
0 Total Likes

Hello all, today I write because i have a doubt, by searching on the internet something for my project i found myself with this code in Matlab, which I am trying to translate to Mathematica but without success, I unfortunately know very little of Matlab, and would ask for your help, then I put the code in Matlab and my attempt in Mathematica, greetings to all. Thank you in advance.

Code en matlab

n=384; m=512; tx=[0:n-1]; ty[0:m-1];

rho=@(x,y) ((1-x^2/50^2-xy/(1550)-y^2/15^2)... *exp(-(x^2/50^2+y^2/15^2)))

my attempt in Mathematica

n=384; m=512;

tx=Range[0,n-1]; ty=Range[0,m-1];

rho[x_,y_]:= 1 - x^2/50^2 - (x y)/(50*15) - y^2/15^2*Exp[-(x^2/50^2) - y^2/15^2]

I hope I have done my job well, but if i have errors please let me know.

POSTED BY: Luis Ledesma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract