⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exact.c

📁 这几个程序是用于计算一维光子晶体反射系数和透射系数的
💻 C
字号:
/*   this is the program for calculating the relection coefficient and 
   trasmition coeficient of a 1-D dielectric layer - ANALYTICAL SOLUTION!!*/
/* Author: Anping Zhao, Nokia Research Center, Helsinki, Finland, 
           Email: anping.zhao@research.nokia.com  */

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

int main ()

{

#define nn 800

double aa[nn],ff[nn],beta[nn];

double xa[nn],xb[nn],xc[nn];

double er0,er1,eps0,xmu0,c0,d,zz,ttt,tt,pi,z0,z1,a0;

int k;

FILE *fp;
fp=fopen ("cas","w");
        
	er0=1.0;

	er1=4.0;

	eps0=8.854e-12;

	xmu0=1.2566e-6;

	c0=1.0/(sqrt(eps0*xmu0));

	d=0.50e-3;

	zz=0.5e-3/20.0;

	ttt=zz/c0;

	tt=0.95*ttt;

        a0=1.0/(1.0e9*tt*nn);

	pi=4.0*atan(1.0);

	z0=sqrt(xmu0/eps0);

	z1=z0/sqrt(er1);

	printf("z0=%e,z1=%e\n",z0,z1);

	for (k=0;k<=200;k++){
	
        ff[k]=k/(tt*a0*nn);
	
        beta[k]=2*pi*ff[k]*sqrt(er1)/c0;

	xa[k]=2*z0*z1;

	xb[k]=(z1*z1+z0*z0)*tan(beta[k]*d);

	xc[k]=(z1*z1-z0*z0)*tan(beta[k]*d);

	aa[k]=sqrt((xb[k]*xc[k])*(xb[k]*xc[k])+(xa[k]*xc[k])*(xa[k]*xc[k]));

     	aa[k]=aa[k]/(xa[k]*xa[k]+xb[k]*xb[k]);

	fprintf(fp,"%6d%15.6f%10.6f%10.6f\n",k,ff[k]/1.0e9,aa[k],

        sqrt(1.0-aa[k]*aa[k]));

	}

fclose(fp);

return 0;

}	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -