软件编程版 #522981 层

请教Mathematica编程问题,在线等,谢谢您的关注

楼主 · 1 楼
因以前没有学过Mathematica,现在上面催的急,如果哪位有时间麻烦帮我看一下,帮忙把下面Mathematica程序用伪C代码描述一下呢?
非常感谢!
*|--S(k)--|--S(k+1)--|--S(k+2)--|--S(k+3--|--S(k+4)--|--S(k+5)--|--S(k+6)--|--S(k+7--|
*|---------sum/i=1..N/S(k+j+i-1) j=0------|
* |---------sum/i=1..N/S(k+j+i-1) j=1--------|
* |---------sum/i=1..N/S(k+j+i-1) j=2--------|
|---------sum/i=1..N/S(k+j+i-1) j=3--------|
|---------sum/i=1..N/S(k+j+i-1) j=A--------|

*df=1/(fn*p*(A+1))*sum/j=0..A/(sum/i=1..N/(S(k+j+i-1))); equ.1*
*p is the measurement interval in seconds*
*fn is nominal frequency multiplied by 20*
*S(k+j+i-1) is the remainder from subtracting p*fn from*
*the number of pulses counted over p seconds interval*
*starting at k+j+i- 1 seconds,*
*N and A are constants*
*[1,2,...A,A+1,...A+1,A,...,2,1] equ.3*
*[1,1,2,2,..,A,A,A+1,...,A+1]* *the number of A+1 is N-A equ.4*
*deltaU1=df*k*omega; equ.2 *
*deltaU2=a*sigma; equ.5 *

fnom=1.0*10^8; *100MHz nominal frequency*
drift_per_day=10^-10/(60*24); *drift per day*
delta_fre_int=10^-9; *initial inaccuracy*
slope=1.5*10^-8; *tuning coefficient*
omega=0.5; *voltage tuning coefficient 1*
thta=0.2; *voltage tuning coefficient 2*
p=60; *measurement interval in seconds*
m=p*600; *test period*
delta_pha_int[0]=30; *initial phase inaccuracy*
N=14; *loop parameter,referring to equ.1*
A=14; *loop parameter,referring to equ.1*
Wsp=Join[Flatten[Table[{i,i},{i,Min[N,A]}]],
Table[Min[N,A]+1,{i,Abs[N-A]}]]; *weights list of the form from equ4*
gps_jit=Table[0*(0.5*10^-7*(Random[]-0.5)),{i,m}]; *random numbers simulating GPS jitter*
df={}; *frequency deviation of the local oscillator as computed by equ.1*
acc_pha_delta={}; *accumulated phase time drift*
Utable={};
Izf=1;f[0]=0;U[0]=0;dU[0]=0;
ZT=Table[0,{i,N+A}];
ZF=Table[0,{i,10}];
Dfpoprz=0;dfakt=0;
For[j=1,j<=m,j++,f[j]=p*fnom*(j*drift_per_day+U[j-1]*k+gps_jit[[j]]/p+delta_frq_int);
For[jk=1,jk<N+A,jk++,ZT[[jk]]=ZT[[jk+1]]];
ZT[[N+A]]=f[j];
delta_pha_int[j]=delta_pha_int[j-1]+f[j];
ZF[[izf]]=delta_pha_int[j];izf=izf+1;
If[izf==11,izf=1,izf=izf];
Dfpoprz=dfakt;
Dfakt=(Apply[Plus,ZF])/10;
Korfaz=dfakt;
dU[j]=-((Dot[ZT,wsp]*omega)/(N*(A+1))+(korfaz*thta)/(N+A))/(slope*p*N*fnom)];
U[j]=U[j-1]+dU[j];
Appendto[df,-dU[j]*slope*N*(1/omega)];
Appendto[acc_pha_delta,delta_pha_int[j]];]