收藏 分享(赏)

实验1 图形用户界面设计.doc

上传人:dzzj200808 文档编号:2253630 上传时间:2018-09-07 格式:DOC 页数:5 大小:70KB
下载 相关 举报
实验1   图形用户界面设计.doc_第1页
第1页 / 共5页
实验1   图形用户界面设计.doc_第2页
第2页 / 共5页
实验1   图形用户界面设计.doc_第3页
第3页 / 共5页
实验1   图形用户界面设计.doc_第4页
第4页 / 共5页
实验1   图形用户界面设计.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、实验 1 图形用户界面设计-公式应用关键程序:curr=get(handles.edit1,string);volt=get(handles.edit2,string);res=get(handles.edit3,string);if curr=0volt=str2num(volt);res=str2num(res);current=volt/res;current=num2str(current);current=strcat(current,A);set(handles.text7,string,current)elseif volt=0curr=str2num(curr);res=str

2、2num(res);voltage=curr*res;voltage=num2str(voltage);voltage=strcat(voltage,V);set(handles.text7,string,voltage)elseif res=0curr=str2num(curr);volt=str2num(volt);resistance=volt/curr;resistance=num2str(resistance);resistance=strcat(resistance,);set(handles.text7,string,resistance)end实验 2 单自由度无阻尼振动系统f

3、unction pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.edit1,string,10);set(handles.edit2,string,0);set(handles.edit3,

4、string,0);set(handles.edit4,string,0);cla(handles.axes1,reset);% - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with ha

5、ndles and user data (see GUIDATA)t0=str2num(get(handles.edit1,string);x0=str2num(get(handles.edit2,string);v0=str2num(get(handles.edit3,string);wn=str2num(get(handles.edit4,string);t=0:0.001:t0;xt=(sqrt(x02+(v0/wn)2)*cos(wn*t-atan2(x0*wn,v0);axes(handles.axes1);plot(t,xt)实验 3 有阻尼振动系统%Tegning af sdof

6、 oscillatorclear all;%System datam=1.0; zeta=0.01; omega0=1.0; Dt=1.0; f0=1.0;x0=0.0; dotx0=0.0;xmax=sqrt(x02+(dotx0/omega0)2)+min(0.5*abs(f0)*Dt/(m*omega0) f0/omega02);omegad=omega0*sqrt(1-zeta2);dt0=0.1*pi/omega0; nstep=500;a=0.70; b=0.70; r=0.35*a; fact=0.50/xmax;xf0=0.5*0 -a 0 a 0;yf0=0 -b/4 -b/

7、2 -3*b/4 -b;xd1=0.5*-a -a a a;yd1=-6*b 0 0 -6*b;xd2=0.5*-0.8*a 0.8*a;yd2=-3*b -3*b;xf0=xf0xf0xf0xf0xf0xf0;yf0=yf0-b+yf0-2*b+yf0-3*b+yf0-4*b+yf0-5*b+yf0;xf=0xf00;xSQ=-a 5*a 5*a -a -a;ySQ=0 0 -2*r -2*r 0;xH=-2000 2000; yH=0 0;xx=x0;tt=0;set(gcf,DoubleBuffer,on);i=1;t=i*dt0;t0=min(t Dt);t1=t-t0;h=exp(-

8、zeta*omega0*t)*sin(omegad*t)/(m*omegad);doth=exp(-zeta*omega0*t)*(cos(omegad*t)-zeta*omega0/omegad*sin(omegad*t)/m;H=(1/m-doth-2*zeta*omega0*h)/omega02;h1=exp(-zeta*omega0*t1)*sin(omegad*t1)/(m*omegad);doth1=exp(-zeta*omega0*t1)*(cos(omegad*t1)-zeta*omega0/omegad*sin(omegad*t1)/m;H1=(1/m-doth1-2*zet

9、a*omega0*h1)/omega02;if tDtt2=t-Dt;h2=exp(-zeta*omega0*t2)*sin(omegad*t2)/(m*omegad);doth2=exp(-zeta*omega0*t2)*(cos(omegad*t2)-zeta*omega0/omegad*sin(omegad*t2)/m;H2=(1/m-doth2-2*zeta*omega0*h2)/omega02;elseH2=0;endx=-f0*H2+f0*(t0/m+h1-h+2*zeta*omega0*(H1-H)/(Dt*omega02);x=x+exp(-zeta*omega0*t)*(x0

10、*cos(omegad*t)+(dotx0+zeta*omega0*x0)*sin(omegad*t)/omegad);tt=ttt;xx=xxx;x=fact*x;yf=0-2*b+(1+x)*yf0-6*b+(1+x)*yf0(size(yf0,1);clf;figure(1);subplot(2,1,1)h1=plot(xH,yH,r);hold onh2=plot(xH,yH-6*b+yf0(size(yf0,1)-r,k);h3=plot(xf,yf,r);h4=plot(4*a+xd1,-3*b+yd1,r);h5=plot(4*a*1 1,-3*b*0 1,r);hej=yf(s

11、ize(yf,1);h6=plot(4*a+xd2,(-7*b+yf(size(yf,1)-hej)*ones(2,1),r);h7=plot(4*a*1 1,-7*b+yf(size(yf,1)-hej yf(size(yf,1),r);h8=plot(xSQ,yf(size(yf,1)+ySQ,r);hold offaxis(-2 5 -10*b+(1+fact*x0)*yf0(size(yf0,1)-2*r r);subplot(2,1,2)h9=plot(xH,yH,k);hold on;h10=plot(tt,-xx,r);hold off;axis( 0 nstep*dt0 -xm

12、ax xmax)% start loopfor i=1:nstept=i*dt0;t0=min(t Dt);t1=t-t0;h=exp(-zeta*omega0*t)*sin(omegad*t)/(m*omegad);doth=exp(-zeta*omega0*t)*(cos(omegad*t)-zeta*omega0/omegad*sin(omegad*t)/m;H=(1/m-doth-2*zeta*omega0*h)/omega02;h1=exp(-zeta*omega0*t1)*sin(omegad*t1)/(m*omegad);doth1=exp(-zeta*omega0*t1)*(c

13、os(omegad*t1)-zeta*omega0/omegad*sin(omegad*t1)/m;H1=(1/m-doth1-2*zeta*omega0*h1)/omega02;if tDtt2=t-Dt;h2=exp(-zeta*omega0*t2)*sin(omegad*t2)/(m*omegad);doth2=exp(-zeta*omega0*t2)*(cos(omegad*t2)-zeta*omega0/omegad*sin(omegad*t2)/m;H2=(1/m-doth2-2*zeta*omega0*h2)/omega02;elseH2=0;endx=-f0*H2+f0*(t0

14、/m+h1-h+2*zeta*omega0*(H1-H)/(Dt*omega02);x=x+exp(-zeta*omega0*t)*(x0*cos(omegad*t)+(dotx0+zeta*omega0*x0)*sin(omegad*t)/omegad);tt=ttt;xx=xxx;x=fact*x;yf=0-2*b+(1+x)*yf0-6*b+(1+x)*yf0(size(yf0,1);set(h3,Xdata,xf);set(h3,Ydata,yf);set(h4,Xdata,4*a+xd1);set(h4,Ydata,-3*b+yd1);set(h5,Xdata,4*a*1 1);set(h5,Ydata,-3*b*0 1);set(h6,Xdata,4*a+xd2);set(h6,Ydata,(-7*b+yf(size(yf,1)-hej)*ones(2,1);set(h7,Xdata,4*a*1 1);set(h7,Ydata,-7*b+yf(size(yf,1)-hej yf(size(yf,1);set(h8,Xdata,xSQ);set(h8,Ydata,yf(size(yf,1)+ySQ);set(h10,Xdata,tt);set(h10,Ydata,-xx);pause(0.1)end;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 大学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报