物理实验数据处理(c语言)

版权声明:所有内容仅供大家学习与复习使用,请勿用于任何商业用途;维特根斯坦曾说过,凡可说的,皆无意义。凡有意义的,皆不得不以荒唐的语言传递其意义。我十分赞同。 https://blog.csdn.net/qq_40828914/article/details/83048774

看程序应该能看懂怎么输入,我就不写具体输入什么了

1.转动惯量的测定

1.不同物体的摆动周期

#include<iostream>
#include<cmath>
using namespace std;

int main(){
	double pi=3.14,jzhi=0.187e-4,jjia=0.321e-4;
	double t0,t1,t2,t3,t4,t5;
	double k,j1,j0,j11,j2,j22,j3,j33,j4,j44,j5,j55;
	double m1,m2,m3,m4,m5;
	double d1,d2o,d2i,d3,d4,d5; 
	cin>>t0>>t1>>t2>>t3>>t4>>t5;
	cin>>m1>>m2>>m3>>m4>>m5;
	cin>>d1>>d2o>>d2i>>d3>>d4>>d5;
	j11=1/8.0*m1*d1*d1;
	j1=j11;
	j0=j11*t0*t0/(t1*t1-t0*t0);
	k=(j1+j0)*4*pi*pi/(t1*t1);
	j22=1/8.0*m2*(d2o*d2o+d2i*d2i);
	j2=k*t2*t2/(4*pi*pi)-j0;
	j33=1/10.0*m3*d3*d3;
	j3=k*t3*t3/(4*pi*pi)-jzhi;
	j44=1/12.0*m4*d4*d4;
	j4=k*t4*t4/(4*pi*pi)-jjia;
	j55=1/8.0*m5*d5*d5;
	j5=k*t5*t5/(4*pi*pi)-j0;
	
	cout<<k<<endl;
	
	cout<<"j2'="<<j22<<";j2="<<j2<<";百分差="<<abs(j22-j2)/j22<<endl;
	cout<<"j3'="<<j33<<";j3="<<j3<<";百分差="<<abs(j33-j3)/j33<<endl;
	cout<<"j4'="<<j44<<";j4="<<j4<<";百分差="<<abs(j44-j4)/j44<<endl;
	cout<<"j5'="<<j55<<";j5="<<j5<<";百分差="<<abs(j55-j5)/j55<<endl;
	
//0.605 0.839 1.245 1.116 2.056 0.959
//
//0.385 0.7079 0.8935 0.1350 0.7160
//
//10 10 9.382 13.25 61 10
}

2.滑块质心离轴不同距离的摆动周期

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	double t1,t2,t3,t4,t5;
	cin>>t1>>t2>>t3>>t4>>t5;
	double j11,j22,j33,j44,j55,j1,j2,j3,j4,j5;
	double pi=3.14,jjia=0.321e-4,m=0.239,j6=0.772e-4;
	double j0,k,m4=0.135,l=61,t=2.056;
	
	j0=1/12.0*m4*l*l;
	k=(j0+jjia)*4*pi*pi/(t*t);
	j11=k*t1*t1/(4*pi*pi)-jjia;
	j22=k*t2*t2/(4*pi*pi)-jjia;
	j33=k*t3*t3/(4*pi*pi)-jjia;
	j44=k*t4*t4/(4*pi*pi)-jjia;
	j55=k*t5*t5/(4*pi*pi)-jjia;
	j1=j0+j6+2*m*5*5;
	j2=j0+j6+2*m*10*10;
	j3=j0+j6+2*m*15*15;
	j4=j0+j6+2*m*20*20;
	j5=j0+j6+2*m*25*25;
	cout<<k<<endl;
	cout<<"实验值j="<<j11<<";理论值j'="<<j1<<";百分差="<<abs(j1-j11)/j1<<endl; 
	cout<<"实验值j="<<j22<<";理论值j'="<<j2<<";百分差="<<abs(j2-j22)/j2<<endl; 
	cout<<"实验值j="<<j33<<";理论值j'="<<j3<<";百分差="<<abs(j3-j33)/j3<<endl; 
	cout<<"实验值j="<<j44<<";理论值j'="<<j4<<";百分差="<<abs(j4-j44)/j4<<endl; 
	cout<<"实验值j="<<j55<<";理论值j'="<<j5<<";百分差="<<abs(j5-j55)/j5<<endl;
	 //2.264 2.918 3.619 4.446 4.866
}

2.密立根油滴实验

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	double pi=3.14,p=1.013e5,d=5e-3;
	double rou=981,g=9.8,kq=1.83e-5,l=1.5e-3,b=8.22e-3;
	double q,t,u,v,a,a0,e=1.6e-19;
	int i=1;
	while(cin>>t>>u){
		cout<<"text: "<<i<<endl;
		v=l/t;
		a0=sqrt( (9*kq*v)/(2*rou*g) );
		a=sqrt((9*kq*v)/(2*rou*g*(1+b/(p*a0))) );
		double q1=18*pi/sqrt(2*rou*g);
		double q2=pow(kq*l/(t*(1+b/p*a)),3.0/2);
		double q3=d/u;
		double q=q1*q2*q3;
		cout<<"q= "<<q<<endl;
		cout<<"电荷数= "<<q/e<<endl;
		cout<<"基本电荷测量值= "<<q/((int)(q/e))<<endl; 
		
		i++;
	}
	
}

没有更多推荐了,返回首页