|
楼主 |
发表于 2007-4-8 19:28
|
显示全部楼层
还有个问题
我不用GUI运行
就在matlab里运行如下代码的话是能出来图的
syms w w1 x y A U Gn h1 h;
K=input('K=')
T1=input('T1=')
T2=input('T2=')
k=2;e0=1; %gai
for A=1.1:0.1:20;
x=2*k/pi*(asin(e0/A)+e0/A*sqrt(1-(e0/A)^2));
y=0;plot(-1/x,y,'m')
hold on
end
num=[K];den=conv(conv([1 0],[T1 1]),[T2 1]);
G=tf(num,den);
w1=1.8:0.1:20;
nyquist(G,w1)
但是在GUI里运以下程序是出不来图的,但也没显示有错误啊?
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hk1=findobj('tag','edit4');K=str2num(get(hk1,'string'));
ht1=findobj('tag','edit5');T1=str2num(get(ht1,'string'));
ht2=findobj('tag','edit6');T2=str2num(get(ht2,'string'));
hlei1=findobj('tag','popupmenu2');lei1=get(hlei1,'value');
axes(handles.axes1);
switch lei1
case 1
ks=2;e0=1; %gai
for A=1.1:0.1:20;
x=2*ks/pi*(asin(e0/A)+e0/A*sqrt(1-(e0/A)^2));
y=0;
plot(-1/x,y,'m');
hold on
end
num=[K];den=conv(conv([1 0],[T1 1]),[T2 1]);
G=tf(num,den);
w1=1.8:0.1:20;
nyquist(G,w1);hold off;
%A w
syms h
w=1/sqrt(T1*T2);
Gn=K/(j*w*(T1*j*w+1)*(j*w*T2+1));
U=real(Gn);
U=vpa(U,4);
h1=-1/(2*ks/pi*(asin(e0/h)+e0/h*sqrt(1-(e0/h)^2)))-U;
[h]=solve(h1,h);
end
ping1=num2str(w);z=subs(h);
set(findobj('tag','edit11'),'string',ping1);
set(findobj('tag','edit12'),'string',z); |
|