经典双积分器引导设计和ODE45模拟,典型控制系统“卫星姿态控制”问题(Matlab代码实现)

 💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

在这个经典的控制系统案例中,我们使用了引导补偿器来解决“卫星姿态控制”问题,并通过ODE45进行了详尽的模拟。通过精心设计的双积分器引导和ODE45模拟,我们能够更好地理解和解决卫星在空间中的姿态控制挑战。这项工作不仅为控制系统设计提供了宝贵的实践经验,也为卫星技术的发展提供了重要的理论支持。

📚2 运行结果

部分代码:

% error for entire iteration interval is constant because we only
   % "sample" it at the iteration loop rate
   et(1:sz(1))   = err;
   eout = [eout et];  % append the error vector for this iteration.
   
   % Same for the reference input
   rt(1:sz(1)) = refin;
   refout = [refout rt];
   
   % Apply the state-space 'C' matrix to the state matrix to obtain
   % angular output for this iteration
   yo = C*x';
   
   % the "sampled" output for the next iteration is that last
   % position solved in this iteration.
   yout = yo(sz(1));
   
   % the "sampled" position is the last value for this iteration
   yzoh(1:sz(1)) = yo(sz(1));  
   yzohout = [yzohout yzoh];
    
   R = [cos(yout) -sin(yout); sin(yout) cos(yout)];
   vo = v*R;     

   % scale the thruster with the error
   thruster_scale = 4;
   th = [0 0; err*thruster_scale 0]
   
   % paint the thruster out the proper side of the capsule...
   % rotate the trust vector and offset it to the proper corner of the
   % capsule.
   if err>0,
    thr = th*R + [vo(1,:); vo(1,:)];
   else
    thr = th*R + [vo(5,:); vo(5,:)];    
   end
   
   % set the capsule graphic plot data for this iteration
   set(hPlot(1),'XData',vo(:,1),'YData',vo(:,2));
   set(hPlot(2),'XData',thr(:,1),'YData',thr(:,2));
   
   % paint the capsule position and reference plot
   yy = C*xout'
   set(hPlotYout(1),'XData',tout,'YData',yy*180/pi);
   set(hPlotYout(2),'XData',tout,'YData',refout*180/pi);
   set(hPlotYout(3),'XData',tout,'YData',yzohout*180/pi);
   
   % paint the current error plot
   set(hPlotErr,'XData',tout,'YData',eout*180/pi);
     
   % set the start time tm for the next iteraton.
   tm = tm + tstep;

   % write the figure frame to the video file
   MM = getframe(fig);
   writeVideo(vidfile,MM);
   
  % loop back for the next iteration
end

🎉3 参考文献

文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。

[1]王荣本,周云山,张友坤,等.自动引导车辆系统的研究(五)控制器设计与试验[J].农业工程学报, 1995, 11(1):71-75.DOI:10.1007/BF02943515.

[2]张欢,秦刚.AGV自动引导车控制系统的设计与研究[J].企业导报, 2012(21):1.DOI:CNKI:SUN:QYDB.0.2012-21-226.

🌈4 Matlab代码实现

  • 21
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
下面是一个简单的Matlab GUI实现ode 14x算法对列车速度控制系统模拟的示例: 1. 创建GUI界面 在Matlab中,可以使用GUIDE工具箱创建GUI界面。在GUIDE工具箱中,选择“Blank GUI (Default)”模板创建一个新的GUI界面。 2. 添加控件 在GUI界面中添加控件,包括按钮、文本框、滑动条等等。对于列车控制系统,可以添加一个滑动条来控制列车速度,添加一个文本框来显示列车当前速度,添加一个按钮来启动或停止列车。 3. 编写回调函数 在Matlab编辑器中,编写回调函数来实现列车控制系统的逻辑。例如,当滑动条的值改变时,可以使用回调函数来更新列车速度;当启动按钮被点击时,可以使用回调函数来开始列车运行。 在本例中,我们使用ode14x函数来模拟列车速度控制系统。在回调函数中,我们使用ode14x函数来计算列车速度的变化,并将结果显示在GUI界面中的文本框中。 ```matlab function startButton_Callback(hObject, eventdata, handles) % hObject handle to startButton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % 初始化列车速度 v0 = 0; % 目标速度 vt = 50; % 列车质量 m = 1000; % 阻力系数 k = 50; % 初始时间 t0 = 0; % 时间步长 dt = 0.1; % 结束时间 tf = 100; % 列车速度ODE函数 odefun = @(t, v) (-k*v^2 + 1000)/(1000 + m); % 列车速度ODE求解器 [t, v] = ode14x(odefun, [t0, tf], v0); % 更新列车速度文本框 set(handles.velocityText, 'String', num2str(v(end))); % 绘制列车速度图像 plot(handles.velocityAxes, t, v); hold(handles.velocityAxes, 'on'); plot(handles.velocityAxes, [0, 100], [vt, vt], 'r--'); xlabel(handles.velocityAxes, 'Time (s)'); ylabel(handles.velocityAxes, 'Velocity (m/s)'); legend(handles.velocityAxes, 'Train Velocity', 'Target Velocity'); hold(handles.velocityAxes, 'off'); ``` 4. 运行GUI界面 保存GUI界面并运行它。现在可以使用滑动条来控制列车速度,观察文本框中的速度值,点击按钮来启动列车运行并观察列车速度随时间的变化。 这只是一个简单的示例,您可以根据实际需要添加更多的控件和逻辑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

荔枝科研社

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值