📄 dsss_demo.mdl
字号:
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "2|[0 -5 -6]|[1 1 0 1 0 1]"
System {
Name "PN signal"
Location [219, 220, 669, 379]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [55, 53, 85, 67]
}
Block {
BlockType Constant
Name "Constant"
Position [235, 105, 265, 135]
Value "-1"
}
Block {
BlockType Ground
Name "Ground"
Position [25, 30, 45, 50]
}
Block {
BlockType SubSystem
Name "Scrambler"
Ports [2, 2]
Position [105, 28, 185, 72]
TreatAsAtomicUnit off
MaskType "Scrambler"
MaskDescription "This block outputs the scrambled signal of "
"the 1st inport input symbol. The block input and output are controlled by the"
" rising edge of the 2nd inport input signal. This block takes scalar input on"
"ly. The first output port outputs the scrambled signal. The second output por"
"t outputs the states of the registers."
MaskHelp "Scrambling is a simple method to minimize t"
"ransferring a long series of the same number, such as 1 or 0. Its operation i"
"s based on a scrambler polynomial g(x). This block scrambles the input signal"
" using the polynomial g(x). You can specify the polynomial using the coeffici"
"ents of the polynomial or by specifying the terms for which the coefficient i"
"s 1; for other terms, the coefficient is the default, 0. For example g = [1 0"
" 0 0 0 0 1 0 1] and g = [0 -6 -8] represent the same polynomial g(x) = 1 + x^"
"(-6) + x^(-8). The initial state of at least one of the registers must be non"
"zero in order to generate a nonzero sequence. The Scrambler block inherits th"
"e sample time from the block that inputs to it."
MaskPromptString "Calculation base:|Scramble polynomial:|Init"
"ial states"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskToolTipString "on,on,on"
MaskVarAliasString ",,"
MaskVariables "M=@1;poly=@2;ini_sta=@3;"
MaskInitialization "if M<=0, error('Scramble calculation base m"
"ust be a positive interger.'); end\nif max(poly)>=M\n error('Scramble polynom"
"ial coefficients must be less than calculation base.');\nelseif min(poly)<0\n"
" tmp = zeros(1, abs(min(poly))+1);\n for i = 1:length(poly), tmp(abs(poly(i"
"))+1) = 1; end\n poly = tmp;\nend\nif poly(1) == 0, poly(1) = 1; end\ns = le"
"ngth(poly)-1;"
MaskDisplay "disp('Scrambler')\nplot(0,0,100,100,[5 10 1"
"0 8 10 12 10 10 15],[5 5 12 8 12 8 12 15 15]+10)"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "M|poly|ini_sta"
System {
Name "Scrambler"
Location [362, 98, 795, 201]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [50, 33, 80, 47]
ShowName off
}
Block {
BlockType Inport
Name "In2"
Position [25, 53, 55, 67]
ShowName off
Port "2"
}
Block {
BlockType Demux
Name "Demux"
Ports [1, 2]
Position [285, 32, 320, 68]
Outputs "[1 s]"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [110, 32, 145, 68]
Inputs "2"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1, 1]
Position [180, 32, 245, 68]
FunctionName "simscram"
Parameters "M, poly, 0, ini_sta"
}
Block {
BlockType Outport
Name "Out2"
Position [380, 33, 410, 47]
ShowName off
InitialOutput "0"
}
Block {
BlockType Outport
Name "Out3"
Position [350, 53, 380, 67]
ShowName off
Port "2"
InitialOutput "0"
}
Line {
SrcBlock "Demux"
SrcPort 2
DstBlock "Out3"
DstPort 1
}
Line {
SrcBlock "Demux"
SrcPort 1
DstBlock "Out2"
DstPort 1
}
Line {
SrcBlock "S-Function"
SrcPort 1
DstBlock "Demux"
DstPort 1
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "S-Function"
DstPort 1
}
Line {
SrcBlock "In2"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Mux"
DstPort 1
}
}
}
Block {
BlockType Switch
Name "Switch"
Position [330, 35, 360, 65]
Threshold "1"
}
Block {
BlockType Terminator
Name "Terminator"
Position [220, 50, 240, 70]
}
Block {
BlockType Outport
Name "Out1"
Position [395, 43, 425, 57]
InitialOutput "0"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Scrambler"
DstPort 2
}
Line {
SrcBlock "Scrambler"
SrcPort 2
DstBlock "Terminator"
DstPort 1
}
Line {
SrcBlock "Ground"
SrcPort 1
DstBlock "Scrambler"
DstPort 1
}
Line {
SrcBlock "Constant"
SrcPort 1
Points [5, 0; 0, -60]
DstBlock "Switch"
DstPort 3
}
Line {
SrcBlock "Switch"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
Line {
SrcBlock "Scrambler"
SrcPort 1
Points [85, 0]
Branch {
DstBlock "Switch"
DstPort 1
}
Branch {
Points [0, 10]
DstBlock "Switch"
DstPort 2
}
}
}
}
Block {
BlockType SubSystem
Name "PN signal1"
Ports [1, 1]
Position [330, 227, 410, 273]
TreatAsAtomicUnit off
MaskType "Pseudorandom sequence generator"
MaskDescription "This block outputs a sequence of pseudorandom s"
"ignals with +1 and -1 values. The rising edge of the input synchronization pu"
"lse triggers the register shifting in the block to update the output."
MaskHelp "See PN sequence block"
MaskPromptString "Calculation base (M):|Generator polynomial (pol"
"y):|Initial states"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskToolTipString "on,on,on"
MaskVarAliasString ",,"
MaskVariables "M=@1;poly=@2;ini_sta=@3;"
MaskInitialization "if M<=0,error('Scramble calculation base must b"
"e a positive integer.'); end\nif max(poly)>=M\nerror('Scramble polynomial coe"
"fficients must be less than calculation base.');\nelseif min(poly)<0\ntmp=ze"
"ros(1, abs(min(poly))+1);\nfor i=1:length(poly), tmp(abs(poly(i))+1) = 1; end"
"\npoly = tmp;\nend\nif poly(1) == 0, poly(1) = 1; end\ns = length(poly)-1;"
MaskDisplay "disp('Pseudorandom\\nsignals\\ngenerator')\nplo"
"t(0,0,100,100,[5 10 10 8 10 12 10 10 15]-5,[5 5 12 8 12 8 12 15 15]+40)"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "2|[0 -5 -6]|[1 1 0 1 0 1]"
System {
Name "PN signal1"
Location [439, 135, 889, 294]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [55, 53, 85, 67]
}
Block {
BlockType Constant
Name "Constant"
Position [235, 105, 265, 135]
Value "-1"
}
Block {
BlockType Ground
Name "Ground"
Position [25, 30, 45, 50]
}
Block {
BlockType SubSystem
Name "Scrambler"
Ports [2, 2]
Position [105, 28, 185, 72]
TreatAsAtomicUnit off
MaskType "Scrambler"
MaskDescription "This block outputs the scrambled signal of "
"the 1st inport input symbol. The block input and output are controlled by the"
" rising edge of the 2nd inport input signal. This block takes scalar input on"
"ly. The first output port outputs the scrambled signal. The second output por"
"t outputs the states of the registers."
MaskHelp "Scrambling is a simple method to minimize t"
"ransferring a long series of the same number, such as 1 or 0. Its operation i"
"s based on a scrambler polynomial g(x). This block scrambles the input signal"
" using the polynomial g(x). You can specify the polynomial using the coeffici"
"ents of the polynomial or by specifying the terms for which the coefficient i"
"s 1; for other terms, the coefficient is the default, 0. For example g = [1 0"
" 0 0 0 0 1 0 1] and g = [0 -6 -8] represent the same polynomial g(x) = 1 + x^"
"(-6) + x^(-8). The initial state of at least one of the registers must be non"
"zero in order to generate a nonzero sequence. The Scrambler block inherits th"
"e sample time from the block that inputs to it."
MaskPromptString "Calculation base:|Scramble polynomial:|Init"
"ial states"
MaskStyleString "edit,edit,edit"
MaskTunableValueString "on,on,on"
MaskCallbackString "||"
MaskEnableString "on,on,on"
MaskVisibilityString "on,on,on"
MaskToolTipString "on,on,on"
MaskVarAliasString ",,"
MaskVariables "M=@1;poly=@2;ini_sta=@3;"
MaskInitialization "if M<=0, error('Scramble calculation base m"
"ust be a positive interger.'); end\nif max(poly)>=M\n error('Scramble polynom"
"ial coefficients must be less than calculation base.');\nelseif min(poly)<0\n"
" tmp = zeros(1, abs(min(poly))+1);\n for i = 1:length(poly), tmp(abs(poly(i"
"))+1) = 1; end\n poly = tmp;\nend\nif poly(1) == 0, poly(1) = 1; end\ns = le"
"ngth(poly)-1;"
MaskDisplay "disp('Scrambler')\nplot(0,0,100,100,[5 10 1"
"0 8 10 12 10 10 15],[5 5 12 8 12 8 12 15 15]+10)"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "M|poly|ini_sta"
System {
Name "Scrambler"
Location [362, 98, 795, 201]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [50, 33, 80, 47]
ShowName off
}
Block {
BlockType Inport
Name "In2"
Position [25, 53, 55, 67]
ShowName off
Port "2"
}
Block {
BlockType Demux
Name "Demux"
Ports [1, 2]
Position [285, 32, 320, 68]
Outputs "[1 s]"
}
Block {
BlockType Mux
Name "Mux"
Ports [2, 1]
Position [110, 32, 145, 68]
Inputs "2"
}
Block {
BlockType "S-Function"
Name "S-Function"
Ports [1, 1]
Position [180, 32, 245, 68]
FunctionName "simscram"
Parameters "M, poly, 0, ini_sta"
}
Block {
BlockType Outport
Name "Out2"
Position [380, 33, 410, 47]
ShowName off
InitialOutput "0"
}
Block {
BlockType Outport
Name "Out3"
Position [350, 53, 380, 67]
ShowName off
Port "2"
InitialOutput "0"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Mux"
DstPort 1
}
Line {
SrcBlock "In2"
SrcPort 1
DstBlock "Mux"
DstPort 2
}
Line {
SrcBlock "Mux"
SrcPort 1
DstBlock "S-Function"
DstPort 1
}
Line {
SrcBlock "S-Function"
SrcPort 1
DstBlock "Demux"
DstPort 1
}
Line {
SrcBlock "Demux"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -