资源描述:
《实验1 图形用户界面设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验1图形用户界面设计-公式应用关键程序:curr=get(handles.edit1,'string');volt=get(handles.edit2,'string');res=get(handles.edit3,'string');ifcurr=='0'volt=str2num(volt);res=str2num(res);current=volt/res;current=num2str(current);current=strcat(current,'A');set(handles.text7,'
2、string',current)elseifvolt=='0'curr=str2num(curr);res=str2num(res);voltage=curr*res;voltage=num2str(voltage);voltage=strcat(voltage,'V');set(handles.text7,'string',voltage)elseifres=='0'curr=str2num(curr);volt=str2num(volt);resistance=volt/curr;resistance
3、=num2str(resistance);resistance=strcat(resistance,'Ω');set(handles.text7,'string',resistance)end实验2单自由度无阻尼振动系统functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB
4、%handlesstructurewithhandlesanduserdata(seeGUIDATA)set(handles.edit1,'string','10');set(handles.edit2,'string','0');set(handles.edit3,'string','0');set(handles.edit4,'string','0');cla(handles.axes1,'reset');%---Executesonbuttonpressinpushbutton2.functionp
5、ushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)t0=str2num(get(handles.edit1,'string'));x0=str2num(get(handles.edit2
6、,'string'));v0=str2num(get(handles.edit3,'string'));wn=str2num(get(handles.edit4,'string'));t=0:0.001:t0;xt=(sqrt(x0^2+(v0/wn)^2))*cos(wn*t-atan2(x0*wn,v0));axes(handles.axes1);plot(t,xt)实验3有阻尼振动系统%Tegningafsdofoscillatorclearall;%Systemdatam=1.0;zeta=0.0
7、1;omega0=1.0;Dt=1.0;f0=1.0;x0=0.0;dotx0=0.0;xmax=sqrt(x0^2+(dotx0/omega0)^2)+min([0.5*abs(f0)*Dt/(m*omega0)f0/omega0^2]);omegad=omega0*sqrt(1-zeta^2);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-a0a0]';yf0=[0-b/4-b/2-3*b/4-
8、b]';xd1=0.5*[-a-aaa]';yd1=[-6*b00-6*b]';xd2=0.5*[-0.8*a0.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=[-a5*a5*a-a-a]';ySQ=[00-2*r-2*r0]';xH=[-20002000