📄 line_fit.mdl
字号:
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
Value "1/14630"
SampleMode "Discrete"
discreteOutput "Frame-based"
continuousOutput "Sample-based"
sampTime "Ts"
framePeriod "N*Ts"
additionalParams off
allowOverrides on
dataType "Inherit from 'Constant value'"
isSigned on
wordLen "16"
udDataType "sfix(16)"
fracBitsMode "Best precision"
numFracBits "15"
InterpretAs1D "-inf"
Ts "-inf"
FramebasedOutput "-inf"
}
Block {
BlockType Reference
Name "DSP\nConstant2"
Ports [0, 1]
Position [85, 159, 150, 191]
SourceBlock "dspsrcs4/DSP\nConstant"
SourceType "DSP Constant"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
Value "[-27.5:27.5]'"
SampleMode "Discrete"
discreteOutput "Frame-based"
continuousOutput "Sample-based"
sampTime "Ts"
framePeriod "N*Ts"
additionalParams off
allowOverrides on
dataType "Inherit from 'Constant value'"
isSigned on
wordLen "16"
udDataType "sfix(16)"
fracBitsMode "Best precision"
numFracBits "15"
InterpretAs1D "-inf"
Ts "-inf"
FramebasedOutput "-inf"
}
Block {
BlockType Reference
Name "DSP\nConstant3"
Ports [0, 1]
Position [440, 109, 475, 141]
SourceBlock "dspsrcs4/DSP\nConstant"
SourceType "DSP Constant"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
Value "-.5"
SampleMode "Discrete"
discreteOutput "Frame-based"
continuousOutput "Sample-based"
sampTime "Ts"
framePeriod "N*Ts"
additionalParams off
allowOverrides on
dataType "Inherit from 'Constant value'"
isSigned on
wordLen "16"
udDataType "sfix(16)"
fracBitsMode "Best precision"
numFracBits "15"
InterpretAs1D "-inf"
Ts "-inf"
FramebasedOutput "-inf"
}
Block {
BlockType Reference
Name "Mean"
Ports [1, 1]
Position [130, 65, 185, 105]
DialogController "dspDDGCreate"
DialogControllerArgs "DataTag3"
SourceBlock "dspstat3/Mean"
SourceType "Mean"
run off
reset_popup "None"
additionalParams off
allowOverrides on
outputMode "Same as accumulator"
outputWordLength "32"
outputFracLength "30"
accumMode "Same as input"
accumWordLength "32"
accumFracLength "30"
roundingMode "Floor"
overflowMode off
LockScale off
Port {
PortNumber 1
Name "ybar"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Product
Name "Product1"
Ports [2, 1]
Position [330, 152, 360, 183]
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
}
Block {
BlockType Product
Name "Product2"
Ports [2, 1]
Position [465, 162, 495, 193]
Inputs "**"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "b1"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Product
Name "Product3"
Ports [2, 1]
Position [560, 117, 590, 148]
Inputs "**"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "b1*xbar"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Outport
Name "Offset"
Position [710, 38, 740, 52]
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "Slope"
Position [715, 173, 745, 187]
Port "2"
IconDisplay "Port number"
}
Line {
Name "b0"
Labels [0, 0]
SrcBlock "Add4"
SrcPort 1
DstBlock "Offset"
DstPort 1
}
Line {
SrcBlock "In1"
SrcPort 1
Points [15, 0]
Branch {
Points [0, 40; 160, 0; 0, -25]
DstBlock "Add2"
DstPort 2
}
Branch {
DstBlock "Mean"
DstPort 1
}
}
Line {
Name "b1*xbar"
Labels [2, 0]
SrcBlock "Product3"
SrcPort 1
Points [15, 0]
DstBlock "Add4"
DstPort 2
}
Line {
Name "b1"
Labels [0, 0]
SrcBlock "Product2"
SrcPort 1
Points [35, 0]
Branch {
DstBlock "Slope"
DstPort 1
}
Branch {
Points [0, -40]
DstBlock "Product3"
DstPort 2
}
}
Line {
SrcBlock "Add"
SrcPort 1
DstBlock "Product2"
DstPort 1
}
Line {
SrcBlock "Product1"
SrcPort 1
DstBlock "Add"
DstPort 1
}
Line {
Name "yi-ybar"
Labels [3, 0]
SrcBlock "Add2"
SrcPort 1
Points [20, 0; 0, 65]
DstBlock "Product1"
DstPort 1
}
Line {
Name "ybar"
Labels [0, 0]
SrcBlock "Mean"
SrcPort 1
Points [30, 0]
Branch {
Labels [2, 0]
Points [0, -50]
DstBlock "Add4"
DstPort 1
}
Branch {
DstBlock "Add2"
DstPort 1
}
}
Line {
SrcBlock "DSP\nConstant1"
SrcPort 1
Points [175, 0; 0, -25]
DstBlock "Product2"
DstPort 2
}
Line {
SrcBlock "DSP\nConstant2"
SrcPort 1
DstBlock "Product1"
DstPort 2
}
Line {
SrcBlock "DSP\nConstant3"
SrcPort 1
DstBlock "Product3"
DstPort 1
}
}
}
Block {
BlockType Display
Name "Slope"
Ports [1]
Position [460, 270, 550, 300]
Decimation "1"
Lockdown off
}
Block {
BlockType Reference
Name "Vector\nScope"
Ports [1]
Position [700, 40, 735, 90]
DialogController "dspdialog.VectorScope"
DialogControllerArgs "DataTag4"
SourceBlock "dspsnks4/Vector\nScope"
SourceType "Vector Scope"
ScopeProperties on
Domain "Time"
HorizSpan "1"
DisplayProperties off
AxisGrid on
Memory off
FrameNumber on
AxisLegend on
AxisZoom off
OpenScopeAtSimStart on
OpenScopeImmediately off
FigPos "[50 200 560 400]"
AxisProperties off
XUnits "Hertz"
XRange "[0...Fs/2]"
InheritXIncr on
XIncr "1"
XLabel "Time"
XLimit "Auto"
XMin "0"
XMax "1"
XStart "0"
YUnits "dB"
YMin "-5"
YMax "5"
YLabel "Amplitude"
LineProperties off
LineStyles "None"
LineMarkers ".|None"
LineColors "k|r"
ShowPortLabels off
}
Line {
SrcBlock "Generate\nNoisy Data"
SrcPort 1
Points [35, 0]
Branch {
DstBlock "Matrix\nConcatenate1"
DstPort 1
}
Branch {
Points [0, 155]
Branch {
DstBlock "Linear Fit"
DstPort 1
}
Branch {
Points [0, 135]
DstBlock "Simplified Linear Fit"
DstPort 1
}
}
}
Line {
SrcBlock "Linear Fit"
SrcPort 1
Points [65, 0]
Branch {
DstBlock "Matrix\nConcatenate"
DstPort 2
}
Branch {
Points [0, 50]
Branch {
DstBlock "Bias"
DstPort 1
}
Branch {
Points [0, 70]
DstBlock "Add1"
DstPort 1
}
}
}
Line {
SrcBlock "Matrix\nConcatenate"
SrcPort 1
DstBlock "Polynomial\nEvaluation"
DstPort 2
}
Line {
SrcBlock "A1"
SrcPort 1
Points [60, 0]
DstBlock "Polynomial\nEvaluation"
DstPort 1
}
Line {
SrcBlock "Polynomial\nEvaluation"
SrcPort 1
Points [20, 0; 0, -50; -125, 0; 0, -50]
DstBlock "Matrix\nConcatenate1"
DstPort 2
}
Line {
SrcBlock "Linear Fit"
SrcPort 2
Points [50, 0]
Branch {
Points [0, -50]
DstBlock "Matrix\nConcatenate"
DstPort 1
}
Branch {
Points [0, 60]
Branch {
DstBlock "Slope"
DstPort 1
}
Branch {
Points [0, 90]
DstBlock "Add"
DstPort 1
}
}
}
Line {
SrcBlock "Matrix\nConcatenate1"
SrcPort 1
DstBlock "Vector\nScope"
DstPort 1
}
Line {
SrcBlock "Simplified Linear Fit"
SrcPort 2
Points [25, 0; 0, 30]
DstBlock "Add"
DstPort 2
}
Line {
SrcBlock "Simplified Linear Fit"
SrcPort 1
DstBlock "Add1"
DstPort 2
}
Line {
SrcBlock "Add"
SrcPort 1
DstBlock "Delta Slope"
DstPort 1
}
Line {
SrcBlock "Add1"
SrcPort 1
DstBlock "Delta Bias"
DstPort 1
}
}
}
MatData {
NumRecords 5
DataRecord {
Tag DataTag4
Data " %)30 . , 8 ( ! % \" 0 0 "
}
DataRecord {
Tag DataTag3
Data " %)30 . 8 8 ( 0 % \" $ ! 0 . , 8 ( ! % \" $ $ 0 0 0 365A;@"
}
DataRecord {
Tag DataTag2
Data " %)30 . 8 8 ( 0 % \" $ ! 0 . , 8 ( ! % \" $ $ 0 0 0 365A;@"
}
DataRecord {
Tag DataTag1
Data " %)30 . 8 8 ( 0 % \" $ ! 0 . , 8 ( ! % \" $ $ 0 0 0 365A;@"
}
DataRecord {
Tag DataTag0
Data " %)30 . T 8 ( @ % \" $ ! 0 % 0 \"0 $ 2 4V5E9 4V5E9$9L86< #@ #@ & \" 0 !0 @ ! !0 $ $ 4 R,S$Q,P X X !@ @ $ 4 ( 0 @ ! ! ( 4V%V95-E960"
}
}
# Finite State Machines
#
# Stateflow Version 6.7 (R2007b) dated Aug 7 2007, 16:48:14
#
#
Stateflow {
machine {
id 1
name "line_fit"
created "19-Jan-2007 15:06:54"
isLibrary 0
firstTarget 2
sfVersion 67014000.000001
sfDemoChecksum [1416551734 3102222473 1623965493 2285850186]
}
target {
id 2
name "sfun"
description "Default Simulink S-Function Target."
machine 1
linkNode [1 0 3]
}
target {
id 3
name "rtw"
codeFlags " comments=1 statebitsets=1 databitsets=1 emitlogicalops=1 elseifdetection=1 constantfolding=1 redundantloadelimination=0 preservenames=0 preservenameswithparent=0 exportcharts=0"
machine 1
linkNode [1 2 0]
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -