matlab实现简单物理实验模拟.docxVIP

  • 13
  • 0
  • 约4.75千字
  • 约 5页
  • 2021-01-01 发布于山东
  • 举报
一 . b a l l . m clear vx=input(pleaseinputthespeedrationofVxandVi:); k=input(coefficientofrebound(1):); ifk=1return,end tm=(1+k)/(1-k); xm=vx*tm; figure plot([0,xm],[0,0],LineWidth,3) gridon axisequal axis([0,xm,0,1]) title(Trajectoeyofball,FontSize,16) xlabel(horizontaldistance(m),FontSize,16) ylabel(Verticalheight(m),FontSize,16) dt=0.001; tm=1; t=0:dt:tm; x=2*vx*t; y=1-t.^2; i=0; holdon whiletm0.01 comet(x,y) plot(x,y,LineWidth,2) i=i+1; tm=2*k.^i; t=0:0.001:tm; x=x(end)+2*vx*t; y=2*k^i*t-t.^2; end . collision.m clear m=0:0.5:2; n=length(m); theta=0:5:90; th=theta*pi/180; [M,TH]=meshgrid(m,th); PHI=2*asin(sin(TH/2)./(1+M))*180/pi; figure(1) plot(theta,PHI(:,1),o-,theta,PHI(:,2),s-,theta,PHI(:,3),d-,... theta,PHI(:,4),p-,theta,PHI(:,5),h-) xlabel(\it\theta\rm/\circ,FontSize,16) ylabel(\it\phi\rm/\circ,FontSize,16) title(Angleofballandobject,FontSize,16) gridon legend([repmat(Ratioofmass\itM/m\rm=,n,1),num2str(m)],2) DE=M./(1+M).*(1-cos(TH)); figure(2) plot(theta,DE(:,1),o-,theta,DE(:,2),d-,theta,DE(:,3),s-,... theta,DE(:,4),p-,theta,DE(:,5),h-) xlabel(\it\theta\rm/\circ,FontSize,16) ylabel(\Delta\itE/mgl,FontSize,16) title(MechanicalEnergy,FontSize,16) gridon legend([repmat(Rationofmass\itM/m\rm=,n,1),num2str(m)],2) . niudunhuan.m clear rm=5; r=-rm:0.01:rm; [X,Y]=meshgrid(r); R=sqrt(X.^2+Y.^2); I=cos(pi*(R.^2+1/2)).^2; I(Rrm)=0; c=linspace(0,1,64); figure d=image(I*64); %ColorMap([c,c*0,c*0]) %ColorMap([c,c,c*0]) ColorMap([c,c,c]) axisoffequal title(Newtonring,FontSize,16) pause h=0; while1 h=h+0.02; I=cos(pi*(R.^2+1/2+2*h)).^2; I(Rrm)=0; set(d,CData,64*I) drawnow ifget(gcf,CurrentCharacter)==char(27)break,end end . stick.m clear g=10; v0=12; theta=input(angleofincidence:); th=theta*pi/180; w=10*pi; l=1; m1=0.2; m2=0.3; r1=l*m2/(m1+m2); r2=l*m1/(m1+m2); t0=2*v0*sin(th)/g; n=200; t=linspace(0,t0,n); xc=v0*cos(th)*t; yc=v0*sin(th)*t-g*t.*t/2; x1=xc+r1*cos(w*t); y1=yc+r1*sin(w*t); x2=xc-r2*cos(w*t); y2=yc-r2*sin(w*t); figure h12=plot([x1(1);x2(1)],[y1(1);y2(1)],-o,L

文档评论(0)

1亿VIP精品文档

相关文档