Error while evaluating uicontrol Callback (matlab新手啊 求大神指点!) 5
我的函数是:clc;closeall;hf=figure('color',[0,1,1],'position',[100,100,500,500],...'Name','...
我的函数是:
clc;close all;hf=figure('color',[0,1,1],'position',[100,100,500,500],... 'Name','RC电路的暂态过程','NumberTitle','off','MenuBar','none');uicontrol(hf,'Style','Text','Units','normalized',... 'Position',[0.1,0.8,0.1,0.05],'HorizontalAlignment','Center',... 'String','R','BackgroundColor',[1,1,0]);uicontrol(hf,'Style','Text','Units','normalized',... 'Position',[0.6,0.8,0.1,0.05],'HorizontalAlignment','Center',... 'String','C','BackgroundColor',[1,1,0]);hedit1=uicontrol(hf,'Style','Edit','Units','normalized',... 'Position',[0.2,0.8,0.1,0.05],'BackgroundColor',[0,1,0]);hedit2=uicontrol(hf,'Style','Edit','Units','normalized',... 'Position',[0.7,0.8,0.1,0.05],'BackgroundColor',[0,1,0]);uicontrol(hf,'Style','Push','Units','normalized',... 'Position',[0.1,0.1,0.2,0.06],... 'String','画 图',... 'Callback','NN');uicontrol(hf,'Style','Push','Units','normalized',... 'Position',[0.65,0.1,0.2,0.06],... 'String','退 出','Callback','close(hf)'); .M文件是
function NNR=str2num(get(hedit1,'String'));C=str2num(get(hedit2,'String'));T=R*C;uc0=4;um=10;w=2;Zc=1/j/w/C;t=0:0.1:10; absH=abs(Zc/(R+Zc));phiH=angle(Zc/(R+Zc));ucst=um*absH*cos(w*t+phiH);ucp0=ucst(1);uctr=(uc0-ucp0)*exp(-t/T);uc=uctr+ucst;plot(t,uc,'-',t,uctr,':',t,ucst,'-.'),grid;legend('uc','ucrt','ucst');end
为什么会出现 展开
clc;close all;hf=figure('color',[0,1,1],'position',[100,100,500,500],... 'Name','RC电路的暂态过程','NumberTitle','off','MenuBar','none');uicontrol(hf,'Style','Text','Units','normalized',... 'Position',[0.1,0.8,0.1,0.05],'HorizontalAlignment','Center',... 'String','R','BackgroundColor',[1,1,0]);uicontrol(hf,'Style','Text','Units','normalized',... 'Position',[0.6,0.8,0.1,0.05],'HorizontalAlignment','Center',... 'String','C','BackgroundColor',[1,1,0]);hedit1=uicontrol(hf,'Style','Edit','Units','normalized',... 'Position',[0.2,0.8,0.1,0.05],'BackgroundColor',[0,1,0]);hedit2=uicontrol(hf,'Style','Edit','Units','normalized',... 'Position',[0.7,0.8,0.1,0.05],'BackgroundColor',[0,1,0]);uicontrol(hf,'Style','Push','Units','normalized',... 'Position',[0.1,0.1,0.2,0.06],... 'String','画 图',... 'Callback','NN');uicontrol(hf,'Style','Push','Units','normalized',... 'Position',[0.65,0.1,0.2,0.06],... 'String','退 出','Callback','close(hf)'); .M文件是
function NNR=str2num(get(hedit1,'String'));C=str2num(get(hedit2,'String'));T=R*C;uc0=4;um=10;w=2;Zc=1/j/w/C;t=0:0.1:10; absH=abs(Zc/(R+Zc));phiH=angle(Zc/(R+Zc));ucst=um*absH*cos(w*t+phiH);ucp0=ucst(1);uctr=(uc0-ucp0)*exp(-t/T);uc=uctr+ucst;plot(t,uc,'-',t,uctr,':',t,ucst,'-.'),grid;legend('uc','ucrt','ucst');end
为什么会出现 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询