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

📄 hybsim.m

📁 由matlab开发的hybrid系统的描述语言
💻 M
字号:
function [XX,DD,ZZ,YY]=hybsim(x0,UU,sys,params,Options)% [XX,DD,ZZ,YY]=HYBSIM(X0,UU,FILE,PARS,OPT)% Simulates a hybrid system% if sys is a simulator-file-name, uses the Matlab simulator (see HYSDEL Manual)% if sys is a MLDstructure, uses MLDSIM which solves a Mixed Integer Program % (see MLDSIM)%% INPUT:% X0  : is the initial condition;% UU  : is the input vector u(t) = UU(:,t);% SYS : system either the filename of the Matlab simulator %              or the Name of the MLD struct% PARS: is the parameters structure passed to the one step %              Matlab simulator (see HYSDEL Manual, Simulator)% OPT : are the options passed to the one step MLDsimulator MLDSIM (see MLDSIM)%      % OUTPUT:% XX  : is the state trajectory% DD  : is the auxiliary bool variables trajectory% ZZ  : is the auxiliary real variables trajectory% YY  : is the output trajectory%% REMARK: % using the matlab simulator is much faster. The results produced by the two% approaches should be the same.% % SEE: % matlab simulator (in the HYSDEL manual, simulator)% MLDSIM% PANMIP% MIQP% % (C) 2002 F.D. Torrisi% Automatic Control Laboratory, ETH Zentrum, CH-8092 Zurich, Switzerland% torrisi@aut.ee.ethz.ch%% see license.txt for the terms and conditions.if nargin < 5         Options.solver      = 'miqp';        Options.miqp.solver = 'linprog';	if nargin < 4		params = [];		if nargin < 3 			error('Too few input parameters');		end	endend		x = x0(:);XX = [];DD = [];ZZ = [];YY = [];if isstr(sys)   for i = 1:size(UU,2),      XX = [XX,x];      u =UU(:,i);      eval(['[x,d,z,y] = ' sys '(x, u, params);']);      DD = [DD,d];      ZZ = [ZZ,z];      YY = [YY,y];   endelseif isstruct(sys)    for i = 1:size(UU,2),      XX = [XX,x];      u =UU(:,i);      [x,d,z,y] = mldsim(sys, x, u, Options);      d = d(:); z = z(:); y = y(:);       DD = [DD,d];      ZZ = [ZZ,z];      YY = [YY,y];   endend

⌨️ 快捷键说明

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