声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 823|回复: 0

[求助]HAPPY教授,还要麻烦你帮帮我

[复制链接]
发表于 2006-4-23 20:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
<P>我是学C的,所以我的程序可能有时候潜意识按照C的规则来写,还要指正了。我下面的程序要做的是,实现A矩阵通过图形界面进行输入,我是想通过一个子函数调用来画出输入矩阵的框图,可是总也画不出来。我想问的问题如下:<BR>1。我想通过用户自己输入阶次来画出矩阵,我是保存在Z里面,不知道后面子函数调用的时候,Z是不是里面有了输入的数据?我这些写程序合适?<BR>2。有没有合适的函数,不用挨个画每个矩阵元素的输入框,只要告诉阶次就可以开辟面积输入?如果没有的话,我这样做,咋总是不能实现我的画矩阵元素输入框功能呢?<BR>3。子函数括号里面需要标出所有用到的变量吗?<BR><BR>我在很努力的看书,但还是解决不了,请您帮看看啊。如果您比较忙,给我指出问题,我自己调试也可以。麻烦了。<BR><BR>clf reset</P>
<P>H=axes('units','normalized','position',[0,0,1,1] ,'visible','off');<BR>set(gcf,'currentaxes',H);<BR>str='\fontname{隶书}极点配置和状态观测器辅助设计工具';<BR>text(0.250,0.93,str,'fontsize',25);<BR>h_fig=get(H,'parent');<BR>set(h_fig,'units','normalized','position',[0.1,0.2,0.7,0.4]);</P>
<P><BR>h_text=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.05,0.8,0.09,0.02],...<BR>  'string',{'输入阶次:'});</P>
<P>h_edit1=uicontrol(h_fig,'style','edit',...<BR>   'unit','normalized','position',[0.15,0.8,0.03,0.03],...<BR>  'callback',['z=str2num(get(gcbo,"string"));']);</P>
<P><BR>h_push1=uicontrol(h_fig,'style','push',...<BR>   'unit','normalized','position',[0.2,0.8,0.1,0.03],...<BR>  'string','确定','callback','creatmatrix(z)');</P>
<P><BR>h_a=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.05,0.7,0.03,0.02],...<BR>   'string',{'A:'});</P>

<P>h_b=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.25,0.7,0.03,0.02],...<BR>  'string',{'B:'});</P>
<P>h_c=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.05,0.50,0.03,0.02],...<BR>  'string',{'C:'});</P>
<P>h_d=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.25,0.50,0.04,0.02],...<BR> 'string',{'D:'});</P>
<P><BR>h_pole1=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.02,0.30,0.15,0.02],...<BR>   'string',{'输入反馈系统的期望极点:'});</P>
<P>h_pole2=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.02,0.20,0.15,0.02],...<BR>  'string',{'输入状态观测器期望极点:'});</P>
<P>h_k=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.05,0.12,0.03,0.02],...<BR>  'string',{'K:'});</P>
<P>h_Ke=uicontrol(h_fig,'style','text',...<BR>   'unit','normalized','position',[0.05,0.05,0.04,0.02],...<BR>   'string',{'Ke:'});</P>

<P>function creatmatrix(z)<BR>for i=1:z<BR>for j=1:z<BR>uicontrol(h_fig,'style','edit',...<BR> 'position',[0.08+(j-1)*0.03,0.6-0.05*(i-1),0.03,0.03],...<BR>'callback',['a(i)(j)=str2num(get(gcbo,"string"));']);<BR>end<BR>end </P>
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-28 17:10 , Processed in 0.064012 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表