wilddrog 发表于 2006-5-23 11:10

请高手看看错在哪

<P>clf reset<BR>H=axes( 'unit' , 'normalized' , 'position' ,, 'visible' , 'off' );<BR>set(gcf, 'currentaxes' ,H);<BR>str= '\fontname{ 隶书 } 如图 ' ;<BR>text(0.12,0.93,str, 'fontsize' ,13);<BR>h_fig=get(H, 'parent' );<BR>set(h_fig, 'unit' , 'normalized' , 'position' ,);<BR>h_axes=axes( 'parent' ,h_fig, ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'xlim' ,, 'ylim' ,, 'fontsize' ,8); </P>

<P>h_text1=uicontrol(h_fig, 'style' , 'text' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , 'string' ,{ ' 输入t1 ' , 't1 ='});<BR>h_edit1=uicontrol(h_fig, 'style' , 'edit' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , ...<BR>'callback' ,[ ...<BR>'z=str2num(get(gcbo,''string''));' , ...<BR>'t=0:0.1:15;' , ...<BR>'for k=1:length(z);' , ...<BR>'s2=tf(1,); ' , ...<BR>'y(:,k)=step(s2,t);' , ...<BR>'plot(t,y(:,k));' , ...<BR>'if (length(z)&gt;1) ,hold on,end,' , ...<BR>'end;' , ...<BR>'hold off,' ]); </P>
<P>h_text2=uicontrol(h_fig, 'style' , 'text' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , 'string' ,{ ' 输入t2 ' , 't2 ='});<BR>h_edit2=uicontrol(h_fig, 'style' , 'edit' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , ...<BR>'callback' ,[ ...<BR>'z=str2num(get(gcbo,''string''));' , ...<BR>'t=0:0.1:15;' , ...<BR>'for k=1:length(z);' , ...<BR>'s2=tf(1,); ' , ...<BR>'y(:,k)=step(s2,t);' , ...<BR>'plot(t,y(:,k));' , ...<BR>'if (length(z)&gt;1) ,hold on,end,' , ...<BR>'end;' , ...<BR>'hold off,' ]); </P>
<P>h_text3=uicontrol(h_fig, 'style' , 'text' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , 'string' ,{ ' 输入t3 ' , 't3 ='});<BR>h_edit3=uicontrol(h_fig, 'style' , 'edit' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , ...<BR>'callback' ,[ ...<BR>'z=str2num(get(gcbo,''string''));' , ...<BR>'t=0:0.1:15;' , ...<BR>'for k=1:length(z);' , ...<BR>'s2=tf(1,); ' , ...<BR>'y(:,k)=step(s2,t);' , ...<BR>'plot(t,y(:,k));' , ...<BR>'if (length(z)&gt;1) ,hold on,end,' , ...<BR>'end;' , ...<BR>'hold off,' ]); </P>
<P><BR>h_text4=uicontrol(h_fig, 'style' , 'text' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , 'string' ,{ ' 输入t4 ' , 't4 ='});<BR>h_edit4=uicontrol(h_fig, 'style' , 'edit' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'horizontal' , 'left' , ...<BR>'callback' ,[ ...<BR>'z=str2num(get(gcbo,''string''));' , ...<BR>'t=0:0.1:15;' , ...<BR>'for k=1:length(z);' , ...<BR>'s2=tf(1,); ' , ...<BR>'y(:,k)=step(s2,t);' , ...<BR>'plot(t,y(:,k));' , ...<BR>'if (length(z)&gt;1) ,hold on,end,' , ...<BR>'end;' , ...<BR>'hold off,' ]); </P>

<P>h_push1=uicontrol(h_fig, 'style' , 'push' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'string' , 'grid on' , 'callback' , 'grid on' );<BR>h_push2=uicontrol(h_fig, 'style' , 'push' , ...<BR>'unit' , 'normalized' , 'position' ,, ...<BR>'string' , 'grid off' , 'callback' , 'grid off' ); <BR></P>

F117_ren_0 发表于 2006-5-23 11:18

<P>你想做什么?我运行这个程序是对的,没显示有错误!~</P>

wilddrog 发表于 2006-5-23 11:30

对应输入t1-t4,运行grid on 得到图形,grid off清除.
页: [1]
查看完整版本: 请高手看看错在哪