📄 ball_anim_obs.mdl
字号:
MaskDescription "Unmask and double-click to see dynamics"
MaskHelp "Nonlinear dynamics of inverted pendulum on cart"
"."
MaskPromptString "Mass of cart (kg):|Mass of pendulum (kg):|Dista"
"nce to pendulum center of mass(m):|Acceleration of gravity (m/s^2):"
MaskStyleString "edit,edit,edit,edit"
MaskTunableValueString "on,on,on,on"
MaskCallbackString "|||"
MaskEnableString "on,on,on,on"
MaskVisibilityString "on,on,on,on"
MaskToolTipString "on,on,on,on"
MaskVarAliasString ",,,"
MaskInitialization "M=@1; m=@2; l=@3; g=@4;"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0.455|0.21|0.61/2|9.8"
MaskTabNameString ",,,"
System {
Name "Pendulum"
Location [113, 142, 622, 314]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "U"
Position [15, 20, 35, 40]
IconDisplay "Port number"
}
Block {
BlockType Fcn
Name "Fcn1"
Position [210, 30, 250, 50]
ShowName off
Expr "(u[1]/m - g*sin(u[3])*cos(u[3]) + l*power(u"
"[2],2)*sin(u[3]))/(M/m + power(sin(u[3]),2))"
}
Block {
BlockType Fcn
Name "Fcn2"
Position [210, 115, 250, 135]
ShowName off
Expr "(-u[1]*cos(u[3])/m + (M+m)*g*sin(u[3])/m - "
"l*power(u[2],2)*sin(u[3])*cos(u[3]))/(l*(M/m + power(sin(u[3]),2)))"
}
Block {
BlockType Integrator
Name "Integrator1"
Ports [1, 1]
Position [385, 30, 405, 50]
ShowName off
IgnoreLimit off
}
Block {
BlockType Integrator
Name "Integrator2"
Ports [1, 1]
Position [385, 115, 405, 135]
ShowName off
IgnoreLimit off
}
Block {
BlockType Integrator
Name "Integrator3"
Ports [1, 1]
Position [305, 115, 325, 135]
ShowName off
IgnoreLimit off
}
Block {
BlockType Integrator
Name "Integrator4"
Ports [1, 1]
Position [305, 30, 325, 50]
ShowName off
IgnoreLimit off
}
Block {
BlockType Mux
Name "Mux"
Ports [3, 1]
Position [140, 109, 170, 141]
ShowName off
Inputs "3"
}
Block {
BlockType Mux
Name "Mux1"
Ports [3, 1]
Position [140, 24, 170, 56]
ShowName off
Inputs "3"
}
Block {
BlockType Outport
Name "Cart"
Position [470, 30, 490, 50]
IconDisplay "Port number"
BusOutputAsStruct off
InitialOutput "0"
}
Block {
BlockType Outport
Name "Pendulum"
Position [470, 115, 490, 135]
Port "2"
IconDisplay "Port number"
BusOutputAsStruct off
InitialOutput "0"
}
Line {
SrcBlock "Integrator1"
SrcPort 1
DstBlock "Cart"
DstPort 1
}
Line {
SrcBlock "Fcn2"
SrcPort 1
DstBlock "Integrator3"
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "Fcn2"
DstPort 1
}
Line {
SrcBlock "Mux1"
SrcPort 1
DstBlock "Fcn1"
DstPort 1
}
Line {
SrcBlock "Fcn1"
SrcPort 1
DstBlock "Integrator4"
DstPort 1
}
Line {
SrcBlock "Integrator4"
SrcPort 1
DstBlock "Integrator1"
DstPort 1
}
Line {
SrcBlock "U"
SrcPort 1
Points [30, 0]
Branch {
DstBlock "Mux1"
DstPort 1
}
Branch {
Points [0, 85]
DstBlock "Mux"
DstPort 1
}
}
Line {
SrcBlock "Integrator3"
SrcPort 1
Points [20, 0]
Branch {
DstBlock "Integrator2"
DstPort 1
}
Branch {
Points [0, -35; -270, 0]
Branch {
Points [0, -50]
DstBlock "Mux1"
DstPort 2
}
Branch {
Points [0, 35]
DstBlock "Mux"
DstPort 2
}
}
}
Line {
SrcBlock "Integrator2"
SrcPort 1
Points [20, 0]
Branch {
DstBlock "Pendulum"
DstPort 1
}
Branch {
Points [0, -50; -335, 0]
Branch {
Points [0, -25]
DstBlock "Mux1"
DstPort 3
}
Branch {
Points [0, 60]
DstBlock "Mux"
DstPort 3
}
}
}
}
}
Block {
BlockType Gain
Name "Proportional Gain"
Position [205, 81, 240, 119]
Gain "-9.4"
}
Block {
BlockType Constant
Name "Reference"
Position [15, 205, 65, 225]
Value "-1.918"
VectorParams1D on
SamplingMode "Sample based"
OutDataTypeMode "Inherit from 'Constant value'"
OutDataType "sfix(16)"
ConRadixGroup "Use specified scaling"
OutScaling "2^0"
SampleTime "inf"
FramePeriod "inf"
}
Block {
BlockType Saturate
Name "Saturation"
Position [385, 150, 410, 170]
ShowName off
UpperLimit "10"
LowerLimit "-10"
}
Block {
BlockType SignalGenerator
Name "Signal Gen."
Ports [0, 1]
Position [15, 138, 60, 172]
ShowName off
WaveForm "square"
Amplitude "0.000000"
Frequency "0.400000"
Units "rad/sec"
}
Block {
BlockType Sum
Name "Sum"
Ports [4, 1]
Position [345, 137, 365, 183]
ShowName off
Inputs "+++-"
}
Block {
BlockType Sum
Name "Sum2"
Ports [2, 1]
Position [145, 145, 165, 165]
ShowName off
Inputs "-+"
}
Block {
BlockType Sum
Name "Sum3"
Ports [2, 1]
Position [90, 150, 110, 170]
ShowName off
}
Block {
BlockType ToWorkspace
Name "To Workspace"
Position [625, 121, 660, 139]
ShowName off
VariableName "y"
SampleTime "0.1"
SaveFormat "Array"
}
Block {
BlockType ToWorkspace
Name "To Workspace1"
Position [625, 166, 660, 184]
ShowName off
VariableName "t"
SampleTime "0.1"
SaveFormat "Array"
}
Line {
SrcBlock "Sum2"
SrcPort 1
Points [0, 0; 10, 0]
Branch {
Points [0, -55]
DstBlock "Proportional Gain"
DstPort 1
}
Branch {
DstBlock "Integral\nGain"
DstPort 1
}
}
Line {
SrcBlock "Discrete State Estimator"
SrcPort 1
Points [0, 0]
DstBlock "Matrix gain."
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
Points [0, 0; 10, 0]
Branch {
Points [0, 60]
DstBlock "To Workspace"
DstPort 1
}
Branch {
DstBlock "Animation"
DstPort 1
}
}
Line {
SrcBlock "Pendulum"
SrcPort 2
Points [0, 0; 35, 0]
Branch {
Points [0, -90]
DstBlock "Mux"
DstPort 3
}
Branch {
Points [0, 85]
DstBlock "Discrete State Estimator"
DstPort 2
}
}
Line {
SrcBlock "Sum3"
SrcPort 1
Points [0, 0]
Branch {
Points [0, -100]
DstBlock "Mux"
DstPort 1
}
Branch {
Points [0, 0]
Branch {
Points [0, 65]
DstBlock "Feedforward Gain"
DstPort 1
}
Branch {
DstBlock "Sum2"
DstPort 2
}
}
}
Line {
SrcBlock "Integral\nGain"
SrcPort 1
DstBlock "Limited\nIntegrator"
DstPort 1
}
Line {
SrcBlock "Sum"
SrcPort 1
DstBlock "Saturation"
DstPort 1
}
Line {
SrcBlock "Proportional Gain"
SrcPort 1
Points [65, 0; 0, 45]
DstBlock "Sum"
DstPort 1
}
Line {
SrcBlock "Feedforward Gain"
SrcPort 1
Points [45, 0; 0, -60]
DstBlock "Sum"
DstPort 3
}
Line {
SrcBlock "Reference"
SrcPort 1
Points [0, -50]
DstBlock "Sum3"
DstPort 2
}
Line {
SrcBlock "Signal Gen."
SrcPort 1
Points [0, 0]
DstBlock "Sum3"
DstPort 1
}
Line {
SrcBlock "Matrix gain."
SrcPort 1
Points [-25, 0; 0, -70]
DstBlock "Sum"
DstPort 4
}
Line {
SrcBlock "Limited\nIntegrator"
SrcPort 1
Points [0, 0]
DstBlock "Sum"
DstPort 2
}
Line {
SrcBlock "Pendulum"
SrcPort 1
Points [0, 0; 20, 0]
Branch {
Points [0, -75]
Branch {
Points [-375, 0]
DstBlock "Sum2"
DstPort 1
}
Branch {
DstBlock "Mux"
DstPort 2
}
}
Branch {
Points [0, 85]
DstBlock "Discrete State Estimator"
DstPort 1
}
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock "Pendulum"
DstPort 1
}
Line {
SrcBlock "Clock"
SrcPort 1
Points [0, 0]
DstBlock "To Workspace1"
DstPort 1
}
Annotation {
Name "Inverted pendulum on cart with Animation"
Position [353, 27]
UseDisplayTextAsClickCallback off
FontSize 14
}
Annotation {
Name "To start and stop the simulation, use the \"Sta"
"rt/Stop\"\nselection in the \"Simulation\" pull-down menu"
Position [361, 312]
UseDisplayTextAsClickCallback off
}
Annotation {
Name "Copyright 1990-2005 The MathWorks Inc."
Position [359, 346]
UseDisplayTextAsClickCallback off
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -