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

📄 invode.m

📁 解压之后.添加到matlab->file->set path里面,就可以直接运行InvGUI.输入具体的数值后,自动plot figure.
💻 M
字号:
function dx = invODE(t,x)

%**************************************************************%
%This functions is to be used with the invGUI.m and invFUN.m   %
%files.  It contains the necessary information to run the non- %
%simulation of the inverted pendulum example.                  %                
%                                                              %
%Copyright (C) 1997 by the Regents of the University of        %
%Michigan.                                                     %
%**************************************************************%

%Retrieve the value of the K matrix.
   Khandle = findobj('Tag','Kframe');
   K = get(Khandle,'Value');

%Retrieve the value of Nbar.     
   Nbarhandle = findobj('Tag','Nbarframe');
   Nbar = get(Nbarhandle,'Value');

%Retrieve the step input value.
   stephandle = findobj('Tag','stepslider');
   stepval=get(stephandle,'Value');
   
  M = 0.5;
  m = 0.2;
  b = 0.1;
  i = 0.006;
  g = 9.8;
  l = 0.3;

  s1=M+m;
  s2=m*l;
  s3=b;
  s4=i+m*l^2;
  s5=m*g*l;
  s6=s2*s2/s4;
  s7=s5*s2/s4;
  s8=s2*s2/s1;
  s9=s2*s3/s1;
  s10=s2/s1;  
F=-K*[x(1) x(2) x(3) x(4)]'+Nbar*stepval;
dx=zeros(4,1);
dx(1)=x(2);
dx(2)=(-F + s2*sin(x(3))*x(2)^2 + s7*sin(x(3))*cos(x(3)) - s3*x(2)) / (s1-s6*cos(x(3))*cos(x(3)));
dx(3)=x(4);
dx(4)=(-s5*sin(x(3)) - s10*(-F)*cos(x(3)) + s8*x(4)*sin(x(3))*cos(x(3)) - s9*x(2)*cos(x(3))) / (s4-s8*cos(x(3))*cos(x(3)));
    

⌨️ 快捷键说明

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