Find Jobs
Hire Freelancers

Conversion

$30-250 USD

In Progress
Posted over 13 years ago

$30-250 USD

Paid on delivery
Convert the following Matlab code into Mathematica code: function C2=TransformC(C1,dia2,tx,ty,thetaR) dia1=C1(1); % Original pupil diameter C1=C1(2:end); etaS=dia2/dia1; % Scaling factor etaT=2*sqrt(tx^2+ty^2)/dia1; % Translation coordinates thetaT=atan2(ty, tx); thetaR=thetaR*pi/180; % Rotation in radians jnm=length(C1)-1; nmax=ceil((-3+sqrt(9+8*jnm))/2); jmax=nmax*(nmax+3)/2; S=zeros(jmax+1,1); S(1:length(C1))=C1; C1=S; clear S P=zeros(jmax+1); % Matrix P transforms from standard to Campbell order N=zeros(jmax+1); % Matrix N contains the normalization coefficients R=zeros(jmax+1); % Matrix R is the coefficients of the radial polynomials CC1=zeros(jmax+1,1); % CC1 is a complex representation of C1 counter=1; for m=-nmax:nmax % Meridional indexes for n=abs(m):2:nmax % Radial indexes jnm=(m+n*(n+2))/2; P(counter,jnm+1)=1; N(counter,counter)=sqrt(n+1); for s=0:(n-abs(m))/2 R(counter-s,counter)=(-1)^s*factorial(n-s)/ ... (factorial(s)*factorial((n+m)/2-s)*factorial((n-m)/2-s)); end if m<0, CC1(jnm+1)=(C1((-m+n*(n+2))/2+1)+i*C1(jnm+1)) /sqrt(2); elseif m==0, CC1(jnm+1)=C1(jnm+1); else, CC1(jnm+1)=(C1(jnm+1)-i*C1((-m+n*(n+2))/2+1)) /sqrt(2) ;end counter=counter+1; end, end ETA=[]; % Coordinate-transfer matrix for m=-nmax:nmax for n=abs(m):2:nmax ETA=[ETA P*(transform(n,m,jmax,etaS,etaT,thetaT,thetaR))]; end, end C=inv(P)*inv(N)*inv(R)*ETA*R*N*P; CC2=C*CC1; C2=zeros(jmax+1,1); % C2 is formed from the complex Zernike coefficients, CC2 for m=-nmax:nmax for n=abs(m):2:nmax jnm=(m+n*(n+2))/2; if m<0, C2(jnm+1)=imag(CC2(jnm+1)-CC2((-m+n*(n+2))/2+1)) /sqrt(2); elseif m==0, C2(jnm+1)=real(CC2(jnm+1)); else, C2(jnm+1)=real(CC2(jnm+1)+CC2((-m+n*(n+2))/2+1)) /sqrt(2); end, end, end C2=[dia2;C2]; % function Eta=transform(n,m,jmax,etaS,etaT,thetaT,thetaR) % Returns coefficients for transforming a ro^n*exp(i*m*theta)-term into ’-terms Eta=zeros(jmax+1,1); for p=0:((n+m)/2) for q=0:((n-m)/2) nnew=n-p-q; mnew=m-p+q; jnm=(mnew+nnew*(nnew+2))/2; Eta(floor(jnm+1))=Eta(floor(jnm+1))+nchoosek((n+m)/2,p)* ... nchoosek((n-m)/2,q)*etaS^(n-p-q)*etaT^(p+q)*exp(i*((p-q)* ... (thetaT-thetaR)+m*thetaR)); end, end % Use the following variables to test the conversion % C1 = [5 00.00 00.00 00.00 00.04 -0.28 00.06 -0.02 00.03 -0.01 -0.02 ... % -0.01 -0.01 00.04 -0.02 00.00 00.00 00.02 -0.03 00.00 00.02 ... % 00.00 00.01 00.01 00.02 00.02 00.00 -0.01]; % dia2 = 5; % tx = 5; % ty = 5; % thetaR = 5;
Project ID: 880439

About the project

8 proposals
Remote project
Active 13 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi! It's is easy as ABC.
$30 USD in 1 day
5.0 (2 reviews)
1.9
1.9
8 freelancers are bidding on average $181 USD for this job
User Avatar
I am MATLAB and MATHMATCA experience, see M.B Abha
$275 USD in 3 days
2.4 (2 reviews)
3.5
3.5
User Avatar
Hello Please check PM. Regards Muhammad
$240 USD in 3 days
4.5 (1 review)
2.7
2.7
User Avatar
in ONE day
$250 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
In less than 24 hours guaranteed.
$190 USD in 1 day
0.0 (0 reviews)
2.0
2.0
User Avatar
Hi! I like mathematic projects and I can start your task today, if need.
$150 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hi, I am very experienced with both MATLAB and Mathematica and I am very confident I can deliver this within 24 hours. Please see my private message to you for further details of my bid.
$170 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CANADA
Waterloo, Canada
0.0
0
Member since Dec 10, 2010

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.