⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 【求助】用matlab进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.htm

📁 用MATLAB进行预测控制的仿真 大家可以参考一下
💻 HTM
📖 第 1 页 / 共 5 页
字号:
      <P><IMG alt="Rank: 1" 
      src="【求助】用MATLAB进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.files/star_level1.gif"></P>
      <UL>
        <LI class=space><A href="http://www.matwav.net/space.php?uid=165744" 
        target=_blank>个人空间</A> </LI>
        <LI class=pm><A onclick="pmwin('open', 'uid=165744')" 
        href="http://bbs.matwav.com/viewthread.php?tid=182990###">发短消息</A> </LI>
        <LI class=buddy><A id=ajax_buddy_9 
        onclick="ajaxmenu(event, this.id, 3000, 0)" 
        href="http://bbs.matwav.com/my.php?item=buddylist&amp;newbuddyid=165744&amp;buddysubmit=yes" 
        target=_blank>加为好友</A> </LI>
        <LI class=offline>当前离线 </LI></UL></TD>
    <TD class=postcontent>
      <DIV class=postinfo><STRONG id=postnum532178 title=复制帖子链接到剪贴板 
      onclick="setcopy('http://bbs.matwav.com/viewthread.php?tid=182990&amp;page=1#pid532178', '帖子链接已经复制到剪贴板')">10<SUP>#</SUP></STRONG> 
      <EM onclick="$('postmessage_532178').className='t_bigfont'">大</EM> <EM 
      onclick="$('postmessage_532178').className='t_msgfont'">中</EM> <EM 
      onclick="$('postmessage_532178').className='t_smallfont'">小</EM> 发表于 
      2006-7-3 09:07&nbsp; <A 
      href="http://bbs.matwav.com/viewthread.php?tid=182990&amp;page=1&amp;authorid=165744" 
      rel=nofollow>只看该作者</A> </DIV>
      <DIV id=ad_thread2_9></DIV>
      <DIV class="postmessage defaultpost">
      <DIV id=ad_thread3_9></DIV>
      <DIV id=ad_thread4_9></DIV>
      <H2>Re:【求助】用MATLAB进行预测控制的仿真</H2>
      <DIV class=t_msgfont id=postmessage_532178>我这里有一个GPC的程序,是我们上课老师布置的作业 
      希望对你有帮助<BR>clear all;<BR>close all;<BR>%Parameter<BR>%Mode<BR>%mode=1 tao 
      does not change, while a changes<BR>%mode=2 tao changes , while a does not 
      change<BR>Mode=2;<BR><BR>%System 
      structure<BR>na=2;<BR>nb=1;<BR>tao=0;<BR><BR>%predictive control 
      parameter<BR>N=5;&nbsp; &nbsp; %predictive time domain<BR>Nu=1;&nbsp; 
      &nbsp;%control time domain<BR><BR>%identification 
      parameters<BR>po_thita=zeros(na+nb+1,1);<BR>mu=0.97;<BR>fai=zeros(na+nb+1,1);<BR>P=10*eye(na+nb+1);<BR><BR>%set 
      trace 
      parameters<BR>T=1;<BR>ta=1.8;<BR>alpha=exp(-T/ta);<BR>c=2;<BR><BR>%input 
      and 
      output<BR>y_temp=zeros(1,3);<BR>y=zeros(1,1000);<BR>u=zeros(1,1000);<BR>u(1,4)=1;<BR>noise=random('Normal', 
      0,0.01,1,991);<BR><BR>%Start<BR>for k=10:1000 <BR>&nbsp; &nbsp; switch 
      Mode<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;case 1<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;tao=6;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if&nbsp;&nbsp;k&lt;=201<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 
      a=0.8854;<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;elseif&nbsp;&nbsp;k&lt;=301<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; a=0.6725;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;elseif&nbsp;&nbsp;k&lt;=401<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 
      a=0.5968;<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;elseif&nbsp;&nbsp;k&lt;=501<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; a=0.7762;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;else<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; a=0.8854;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;end<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;case 2<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;a=0.8854;<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;if&nbsp; &nbsp;&nbsp;&nbsp;k&lt;=201<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; tao=6;<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;elseif&nbsp;&nbsp;k&lt;=301<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; tao=4;&nbsp; &nbsp;&nbsp;&nbsp;<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;elseif&nbsp;&nbsp;k&lt;=401<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; tao=8;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;elseif&nbsp;&nbsp;k&lt;=501<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 
      tao=6;<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;else<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp; tao=6;<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;end<BR>&nbsp; &nbsp; end<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      y_temp(1)=(a+0.264)*y_temp(2)-0.264*a*y_temp(3)+0.864*u(k-tao)-0.2731*u(k-tao-1);<BR>&nbsp; 
      &nbsp; y(k)=y_temp(1)+noise(k-9);<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      y_temp(3)=y_temp(2);<BR>&nbsp; &nbsp; y_temp(2)=y_temp(1);<BR>&nbsp; 
      &nbsp; <BR>&nbsp; &nbsp; %identification<BR>&nbsp; &nbsp; <BR>&nbsp; 
      &nbsp; %fai<BR>&nbsp; &nbsp; for i=1:na<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;fai(i)=-(y(k-i)-y(k-i-1));<BR>&nbsp; &nbsp; 
      end<BR>&nbsp; &nbsp; for i=1:nb+1<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;fai(na+i)=u(k-tao+1-i)-u(k-tao+1-i-1);<BR>&nbsp; &nbsp; 
      end<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      kai=P*fai/(fai'*P*fai+mu);<BR>&nbsp; &nbsp; 
      P=(mu^(-1))*(eye(na+nb+1)-kai*fai')*P;<BR>&nbsp; &nbsp; 
      po_thita=po_thita+kai*(y(k)-y(k-1)-fai'*po_thita);<BR>&nbsp; &nbsp; 
      thita=[1,po_thita'];<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; %diophantine&nbsp; 
      &nbsp; <BR>&nbsp; &nbsp; f=zeros(na+1,1);<BR>&nbsp; &nbsp; 
      f(1)=1;<BR>&nbsp; &nbsp; f_f=zeros(N,na+1);<BR>&nbsp; &nbsp; 
      E=cell(1,N);<BR>&nbsp; &nbsp; E{1}=1;<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      g=cell(1,N);<BR>&nbsp; &nbsp; g_g=zeros(N,Nu);<BR>&nbsp; &nbsp; 
      f_t=zeros(N,1);<BR>&nbsp; &nbsp; g_t=zeros(N,1);<BR>&nbsp; &nbsp; 
      w=zeros(N,1);<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; for ite1=1:N<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;f_e=f(1);<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;for ite2=1:na<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; 
      &nbsp;f(ite2)=f(ite2+1)-(thita(ite2+1)-thita(ite2))*f_e;<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;f(na+1)=thita(na+1)*f_e;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;f_f(ite1,<IMG alt="" 
      src="【求助】用MATLAB进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.files/smile.gif" 
      border=0 smilieid="1">=f';<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if 
      ite1&lt;N<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;E{ite1+1}=[E{ite1},f(1)];<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp; end<BR>&nbsp; &nbsp; <BR>&nbsp; 
      &nbsp; %compute g<BR>&nbsp; &nbsp; for ite1=1:N<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;g{ite1}=zeros(1,nb+ite1);<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;for ite2=1:nb+ite1<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;for ite3=1:ite1<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; temp=ite2+1-ite3;<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; if 
      (temp&lt;=nb+1)&amp;(temp&gt;=1)<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;g{ite1}(ite2)=g{ite1}(ite2)+thita(na+1+temp)*E{ite1}(ite3);<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; end<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;end<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp; end<BR>&nbsp; &nbsp; <BR>&nbsp; 
      &nbsp; %compute g_g<BR>&nbsp; &nbsp; for ite1=1:N<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp; if ite1&lt;=Nu<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;for ite2=1:ite1<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;g_g(ite1,1+ite1-ite2)=g{ite1}(ite2);<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp;&nbsp; &nbsp; 
      else<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;for 
      ite2=1:Nu<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;g_g(ite1,Nu+1-ite2)=g{ite1}(ite1-Nu+ite2);<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp;&nbsp; &nbsp; 
      end<BR>&nbsp; &nbsp; end<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; %compute 
      f_n*y(k)<BR>&nbsp; &nbsp; for ite1=1:N<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;for ite2=1:na+1<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp; 
      &nbsp;f_t(ite1)=f_t(ite1)+f_f(ite1,ite2)*y(k+1-ite2);<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp; end<BR>&nbsp; &nbsp; 
      <BR>&nbsp; &nbsp; %compute g_n*u(k)<BR>&nbsp; &nbsp; for 
      ite1=1:N<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;for ite2=1:nb<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 
      &nbsp;g_t(ite1)=g_t(ite1)+g{ite1}(ite2+ite1)*(u(k-tao-ite2)-u(k-tao-ite2-1));<BR>&nbsp; 
      &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<BR>&nbsp; &nbsp; end&nbsp; &nbsp; 
      <BR>&nbsp; &nbsp; % set trace&nbsp; &nbsp;<BR>&nbsp; &nbsp; for 
      ite1=1:N<BR>&nbsp; &nbsp;&nbsp; 
      &nbsp;&nbsp;&nbsp;w(ite1)=alpha^(ite1)*y(k)+(1-alpha^(ite1))*c;<BR>&nbsp; 
      &nbsp; end<BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; %compute u&nbsp; &nbsp; 
      <BR>&nbsp; &nbsp; r_ft=g_t+f_t;<BR>&nbsp; &nbsp; 
      be_u=inv(g_g'*g_g+eye(Nu))*g_g';<BR>&nbsp; &nbsp; 
      u(k-tao+1)=u(k-tao)+be_u(1,<IMG alt="" 
      src="【求助】用MATLAB进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.files/smile.gif" 
      border=0 smilieid="1">*(w-r_ft);&nbsp; &nbsp; <BR>end<BR>%plot y 
      u<BR>plot(y);<BR>figure;<BR>plot(u);</DIV>
      <DIV id=post_rate_div_532178></DIV></DIV></TD></TR>
  <TR>
    <TD class=postauthor>
      <DIV class="popupmenu_popup userinfopanel" id=userinfo532178_menu 
      style="DISPLAY: none">
      <DL>
        <DT>UID</DT>
        <DD>165744&nbsp;</DD>
        <DT>帖子</DT>
        <DD>8&nbsp;</DD>
        <DT>精华</DT>
        <DD><A 
        href="http://bbs.matwav.com/digest.php?authorid=165744">0</A>&nbsp;</DD>
        <DT>积分</DT>
        <DD>0&nbsp;</DD>
        <DT>阅读权限</DT>
        <DD>10&nbsp;</DD>
        <DT>来自</DT>
        <DD>浙江 杭州&nbsp;</DD>
        <DT>在线时间</DT>
        <DD>0 小时&nbsp;</DD>
        <DT>注册时间</DT>
        <DD>2006-3-8&nbsp;</DD>
        <DT>最后登录</DT>
        <DD>2008-1-3&nbsp;</DD></DL>
      <P><A href="http://bbs.matwav.com/space.php?uid=165744" 
      target=_blank>查看详细资料</A></P></DIV></TD>
    <TD class=postcontent>
      <DIV class=postactions>
      <P><STRONG title=顶部 onclick=scroll(0,0)>TOP</STRONG> </P>
      <DIV id=ad_thread1_9></DIV></DIV></TD></TR></TBODY></TABLE></DIV></FORM>
<SCRIPT type=text/javascript>var tagarray = ['雷达','求助','北京','频谱','泄漏','ifft','傅里叶逆变换','IEEE','Radar','Conference','参加','天线方向图','威力','压缩传感','fft','交通灯','模糊算法','论文集','年会','mex','请教','超值宝贝推荐','神经网络','浏览器','动画','正高','系统','办公','数据采集、信号分析'];var tagencarray = ['%C0%D7%B4%EF','%C7%F3%D6%FA','%B1%B1%BE%A9','%C6%B5%C6%D7','%D0%B9%C2%A9','ifft','%B8%B5%C0%EF%D2%B6%C4%E6%B1%E4%BB%BB','IEEE','Radar','Conference','%B2%CE%BC%D3','%CC%EC%CF%DF%B7%BD%CF%F2%CD%BC','%CD%FE%C1%A6','%D1%B9%CB%F5%B4%AB%B8%D0','fft','%BD%BB%CD%A8%B5%C6','%C4%A3%BA%FD%CB%E3%B7%A8','%C2%DB%CE%C4%BC%AF','%C4%EA%BB%E1','mex','%C7%EB%BD%CC','%B3%AC%D6%B5%B1%A6%B1%B4%CD%C6%BC%F6','%C9%F1%BE%AD%CD%F8%C2%E7','%E4%AF%C0%C0%C6%F7','%B6%AF%BB%AD','%D5%FD%B8%DF','%CF%B5%CD%B3','%B0%EC%B9%AB','%CA%FD%BE%DD%B2%C9%BC%AF%A1%A2%D0%C5%BA%C5%B7%D6%CE%F6'];parsetag(182990);</SCRIPT>

<DIV class=pages_btns>
<DIV class=threadflow><A 
href="http://bbs.matwav.com/redirect.php?fid=616&amp;tid=182990&amp;goto=nextoldset">&#8249;&#8249; 
上一主题</A> | <A 
href="http://bbs.matwav.com/redirect.php?fid=616&amp;tid=182990&amp;goto=nextnewset">下一主题 
&#8250;&#8250;</A></DIV>
<DIV class=pages><EM>&nbsp;18&nbsp;</EM><STRONG>1</STRONG><A 
href="http://bbs.matwav.com/viewthread.php?tid=182990&amp;extra=&amp;page=2">2</A><A 
class=next 
href="http://bbs.matwav.com/viewthread.php?tid=182990&amp;extra=&amp;page=2">&#8250;&#8250;</A></DIV><SPAN 
class=postbtn id=newspecialtmp 
onmouseover="$('newspecial').id = 'newspecialtmp';this.id = 'newspecial';showMenu(this.id)"><A 
href="http://bbs.matwav.com/post.php?action=newthread&amp;fid=616&amp;extra="><IMG 
title=发新话题 alt=发新话题 
src="【求助】用MATLAB进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.files/newtopic.gif" 
border=0></A></SPAN> <SPAN class=replybtn><A 
href="http://bbs.matwav.com/post.php?action=reply&amp;fid=616&amp;tid=182990&amp;extra="><IMG 
alt="" src="【求助】用MATLAB进行预测控制的仿真 - 预测控制 - 自动控制 - 研学论坛 研学学术科技.files/reply.gif" 
border=0></A></SPAN></DIV>
<SCRIPT type=text/javascript>
var maxpage = 2;
if(maxpage > 1) {
	document.onkeyup = function(e){
		e = e ? e : window.event;
		var tagname = is_ie ? e.srcElement.tagName : e.target.tagName;
		if(tagname == 'INPUT' || tagname == 'TEXTAREA') return;
		actualCode = e.keyCode ? e.keyCode : e.charCode;
				if(actualCode == 39) {
			window.location = 'viewthread.php?tid=182990&page=2';
		}
					}
}
</SCRIPT>
</DIV>
<UL class="popupmenu_popup headermenu_popup" id=memcp_menu 
style="DISPLAY: none">
  <LI><A href="http://bbs.matwav.com/memcp.php">控制面板首页</A> </LI>
  <LI><A href="http://bbs.matwav.com/memcp.php?action=profile">编辑个人资料</A> </LI>
  <LI><A href="http://bbs.matwav.com/memcp.php?action=credits">积分交易</A> </LI>
  <LI><A href="http://bbs.matwav.com/memcp.php?action=creditslog">积分记录</A> </LI>
  <LI><A href="http://bbs.matwav.com/memcp.php?action=usergroups">公众用户组</A> 
</LI></UL>
<UL class="popupmenu_popup headermenu_popup" id=stats_menu 
style="DISPLAY: none">
  <LI><A href="http://bbs.matwav.com/stats.php">基本概况</A> </LI>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -