dds_n256l.mdl

来自「用MATLAB中的SIMULINK工具实现DDS的仿真模型」· MDL 代码 · 共 1,523 行 · 第 1/3 页

MDL
1,523
字号
      Name		      "Phase\nAccumulator"
      Ports		      [2, 1]
      Position		      [90, 80, 130, 140]
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      System {
	Name			"Phase\nAccumulator"
	Location		[32, 149, 432, 398]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"A4"
	PaperUnits		"centimeters"
	ZoomFactor		"100"
	Block {
	  BlockType		  Inport
	  Name			  "In1"
	  Position		  [115, 25, 145, 40]
	  Orientation		  "down"
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "In2"
	  Position		  [25, 88, 55, 102]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "Triggered\nSubsystem"
	  Ports			  [1, 1, 0, 1]
	  Position		  [80, 74, 180, 116]
	  TreatAsAtomicUnit	  on
	  MinAlgLoopOccurrences	  off
	  RTWSystemCode		  "Auto"
	  System {
	    Name		    "Triggered\nSubsystem"
	    Location		    [353, 328, 855, 680]
	    Open		    off
	    ModelBrowserVisibility  off
	    ModelBrowserWidth	    200
	    ScreenColor		    "white"
	    PaperOrientation	    "landscape"
	    PaperPositionMode	    "auto"
	    PaperType		    "A4"
	    PaperUnits		    "centimeters"
	    ZoomFactor		    "100"
	    Block {
	      BlockType		      Inport
	      Name		      "In1"
	      Position		      [110, 103, 140, 117]
	      Port		      "1"
	      IconDisplay	      "Port number"
	      LatchInput	      off
	    }
	    Block {
	      BlockType		      TriggerPort
	      Name		      "Trigger"
	      Ports		      []
	      Position		      [225, 20, 245, 40]
	      StatesWhenEnabling      "held"
	    }
	    Block {
	      BlockType		      "S-Function"
	      Name		      "S-Function"
	      Ports		      [1, 1]
	      Position		      [225, 95, 285, 125]
	      FunctionName	      "addcontrolk"
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "Out1"
	      Position		      [360, 103, 390, 117]
	      IconDisplay	      "Port number"
	      BusOutputAsStruct	      off
	    }
	    Line {
	      SrcBlock		      "In1"
	      SrcPort		      1
	      DstBlock		      "S-Function"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "S-Function"
	      SrcPort		      1
	      DstBlock		      "Out1"
	      DstPort		      1
	    }
	  }
	}
	Block {
	  BlockType		  SubSystem
	  Name			  "period\nSubsystem"
	  Ports			  [1, 1]
	  Position		  [235, 65, 275, 125]
	  TreatAsAtomicUnit	  off
	  MinAlgLoopOccurrences	  off
	  RTWSystemCode		  "Auto"
	  System {
	    Name		    "period\nSubsystem"
	    Location		    [2, 74, 1014, 744]
	    Open		    off
	    ModelBrowserVisibility  off
	    ModelBrowserWidth	    200
	    ScreenColor		    "white"
	    PaperOrientation	    "landscape"
	    PaperPositionMode	    "auto"
	    PaperType		    "A4"
	    PaperUnits		    "centimeters"
	    ZoomFactor		    "100"
	    Block {
	      BlockType		      Inport
	      Name		      "In1"
	      Position		      [105, 33, 135, 47]
	      Port		      "1"
	      IconDisplay	      "Port number"
	      LatchInput	      off
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant1"
	      Position		      [55, 145, 85, 175]
	      Value		      "2"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant2"
	      Position		      [210, 135, 240, 165]
	      Value		      "2"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant3"
	      Position		      [50, 200, 80, 230]
	      Value		      "24"
	    }
	    Block {
	      BlockType		      Constant
	      Name		      "Constant4"
	      Position		      [215, 185, 245, 215]
	      Value		      "16"
	    }
	    Block {
	      BlockType		      Product
	      Name		      "Divide1"
	      Ports		      [2, 1]
	      Position		      [385, 77, 415, 108]
	      Inputs		      "*/"
	      InputSameDT	      off
	      OutDataTypeMode	      "Inherit via internal rule"
	      OutScaling	      "2^-10"
	      RndMeth		      "Floor"
	      SaturateOnIntegerOverflow	off
	    }
	    Block {
	      BlockType		      Math
	      Name		      "Math\nFunction"
	      Ports		      [2, 1]
	      Position		      [195, 32, 225, 63]
	      Operator		      "mod"
	      OutputSignalType	      "real"
	    }
	    Block {
	      BlockType		      Math
	      Name		      "Math\nFunction1"
	      Ports		      [2, 1]
	      Position		      [135, 152, 165, 183]
	      Operator		      "pow"
	      OutputSignalType	      "real"
	    }
	    Block {
	      BlockType		      Math
	      Name		      "Math\nFunction2"
	      Ports		      [2, 1]
	      Position		      [290, 142, 320, 173]
	      Operator		      "pow"
	      OutputSignalType	      "real"
	    }
	    Block {
	      BlockType		      Rounding
	      Name		      "Rounding\nFunction"
	      Position		      [470, 80, 500, 110]
	      Operator		      "round"
	    }
	    Block {
	      BlockType		      Outport
	      Name		      "Out1"
	      Position		      [575, 88, 605, 102]
	      IconDisplay	      "Port number"
	      BusOutputAsStruct	      off
	    }
	    Line {
	      SrcBlock		      "In1"
	      SrcPort		      1
	      DstBlock		      "Math\nFunction"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant1"
	      SrcPort		      1
	      DstBlock		      "Math\nFunction1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant3"
	      SrcPort		      1
	      Points		      [5, 0; 0, -40]
	      DstBlock		      "Math\nFunction1"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Math\nFunction1"
	      SrcPort		      1
	      Points		      [5, 0; 0, -115]
	      DstBlock		      "Math\nFunction"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Math\nFunction2"
	      SrcPort		      1
	      Points		      [30, 0; 0, -60]
	      DstBlock		      "Divide1"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Constant2"
	      SrcPort		      1
	      DstBlock		      "Math\nFunction2"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Constant4"
	      SrcPort		      1
	      Points		      [25, 0]
	      DstBlock		      "Math\nFunction2"
	      DstPort		      2
	    }
	    Line {
	      SrcBlock		      "Math\nFunction"
	      SrcPort		      1
	      Points		      [70, 0; 0, 35]
	      DstBlock		      "Divide1"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Divide1"
	      SrcPort		      1
	      DstBlock		      "Rounding\nFunction"
	      DstPort		      1
	    }
	    Line {
	      SrcBlock		      "Rounding\nFunction"
	      SrcPort		      1
	      DstBlock		      "Out1"
	      DstPort		      1
	    }
	  }
	}
	Block {
	  BlockType		  Outport
	  Name			  "Out1"
	  Position		  [300, 88, 330, 102]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  "Triggered\nSubsystem"
	  SrcPort		  1
	  DstBlock		  "period\nSubsystem"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "In1"
	  SrcPort		  1
	  DstBlock		  "Triggered\nSubsystem"
	  DstPort		  trigger
	}
	Line {
	  SrcBlock		  "In2"
	  SrcPort		  1
	  DstBlock		  "Triggered\nSubsystem"
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "period\nSubsystem"
	  SrcPort		  1
	  DstBlock		  "Out1"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Reference
      Name		      "Power Spectral\nDensity"
      Ports		      [1]
      Position		      [365, 65, 395, 95]
      SourceBlock	      "simulink_extras/Additional\nSinks/Power Spectra"
"l\nDensity"
      SourceType	      "Power Spectral Density"
      ShowPortLabels	      on
      npts		      "256"
      fftpts		      "512"
      HowOften		      "128"
      sampleT		      "0.1/RF"
    }
    Block {
      BlockType		      DiscretePulseGenerator
      Name		      "Pulse\nGenerator"
      Ports		      [0, 1]
      Position		      [15, 48, 60, 82]
      PulseType		      "Time based"
      Period		      "1/RF"
      PulseWidth	      "50"
    }
    Block {
      BlockType		      Reference
      Name		      "RAM\nTable\n256"
      Ports		      [1, 1]
      Position		      [160, 82, 215, 138]
      SourceBlock	      "simulink/Lookup\nTables/Direct Lookup\nTable (n"
"-D)"
      SourceType	      "LookupNDDirect"
      maskTabDims	      "1"
      explicitNumDims	      "1"
      outDims		      "Element"
      tabIsInput	      off
      mxTable		      "[0 0.01227153828572   0.03680722294136   0.0613"
"2073630221   0.08579731234444   0.11022220729388   0.13458070850713   0.15885"
"814333386   0.18303988795514    0.20711137619222   0.23105810828067   0.25486"
"565960451   0.27851968938505    0.30200594931923   0.32531029216226   0.34841"
"868024943   0.37131719395184    0.39399204006105   0.41642956009764   0.43861"
"623853853   0.46053871095824    0.48218377207912   0.50353838372572   0.52458"
"968267847   0.54532498842205    0.56573181078361   0.58579785745644   0.60551"
"104140433   0.62485948814239    0.64383154288979   0.66241577759017   0.68060"
"099779545   0.69837624940897    0.71573082528382   0.73265427167241   0.74913"
"639452346   0.76516726562246    0.78073722857209   0.79583690460888   0.81045"
"719825259   0.82458930278503    0.83822470555484   0.85135519310527   0.86397"
"285612159   0.87607009419541    0.88763962040285   0.89867446569395   0.90916"
"798309052   0.91911385169006   0.92850608047322   0.93733901191257   0.945607"
"32538052   0.95330604035419   0.96043051941557   0.96697647104485   0.9729399"
"5220556   0.97831737071963    0.98310548743122   0.98730141815786   0.9909026"
"3542778   0.99390697000236   0.99631261218278   0.99811811290015   0.99932238"
"458835   0.99992470183914   0.99992470183914   0.99932238458835   0.998118112"
"90015   0.99631261218278    0.99390697000236   0.99090263542778   0.987301418"
"15786   0.98310548743122    0.97831737071963   0.97293995220556   0.966976471"
"04485   0.96043051941557    0.95330604035419   0.94560732538052   0.937339011"
"91257   0.92850608047322    0.91911385169006   0.90916798309052   0.898674465"
"69395   0.88763962040285    0.87607009419541   0.86397285612159   0.851355193"
"10527   0.83822470555484    0.82458930278503   0.81045719825259   0.795836904"
"60888   0.78073722857209    0.76516726562246   0.74913639452346   0.732654271"
"67241   0.71573082528382    0.69837624940897   0.68060099779545   0.662415777"
"59017   0.64383154288979    0.62485948814239   0.60551104140433   0.585797857"
"45644   0.56573181078361    0.54532498842205   0.52458968267847   0.503538383"
"72572   0.48218377207912    0.46053871095824   0.43861623853853   0.416429560"
"09764   0.39399204006105   0.37131719395184   0.34841868024943   0.3253102921"
"6226   0.30200594931923    0.27851968938505   0.25486565960451   0.2310581082"
"8067   0.20711137619222    0.18303988795514   0.15885814333386   0.1345807085"
"0713   0.11022220729388    0.08579731234444   0.06132073630221   0.0368072229"
"4136   0.01227153828572    -0.01227153828572  -0.03680722294136  -0.061320736"
"30221  -0.08579731234444    -0.11022220729388  -0.13458070850713  -0.15885814"
"333386  -0.18303988795514    -0.20711137619222  -0.23105810828067  -0.2548656"
"5960451  -0.27851968938505    -0.30200594931923  -0.32531029216226  -0.348418"
"68024943  -0.37131719395184    -0.39399204006105  -0.41642956009764  -0.43861"
"623853853  -0.46053871095824   -0.48218377207912  -0.50353838372572  -0.52458"
"968267847  -0.54532498842205    -0.56573181078361  -0.58579785745644  -0.6055"
"1104140433  -0.62485948814239    -0.64383154288979  -0.66241577759017  -0.680"
"60099779545  -0.69837624940897    -0.71573082528382  -0.73265427167241  -0.74"
"913639452346  -0.76516726562246    -0.78073722857209  -0.79583690460888  -0.8"
"1045719825259  -0.82458930278503    -0.83822470555484  -0.85135519310526  -0."
"86397285612159  -0.87607009419541    -0.88763962040285  -0.89867446569395  -0"
".90916798309052  -0.91911385169006    -0.92850608047322  -0.93733901191257  -"
"0.94560732538052  -0.95330604035419    -0.96043051941557  -0.96697647104485  "
"-0.97293995220556  -0.97831737071963   -0.98310548743122  -0.98730141815786  "
"-0.99090263542778  -0.99390697000236    -0.99631261218278  -0.99811811290015 "
" -0.99932238458835  -0.99992470183914    -0.99992470183914  -0.99932238458835"
"  -0.99811811290015  -0.99631261218278    -0.99390697000236  -0.9909026354277"
"8  -0.98730141815786  -0.98310548743122   -0.97831737071963  -0.9729399522055"
"6  -0.96697647104485  -0.96043051941557    -0.95330604035419  -0.945607325380"
"52  -0.93733901191257  -0.92850608047322    -0.91911385169006  -0.90916798309"
"052  -0.89867446569395  -0.88763962040285    -0.87607009419541  -0.8639728561"
"2159  -0.85135519310527  -0.83822470555484    -0.82458930278503  -0.810457198"
"25259  -0.79583690460888  -0.78073722857209   -0.76516726562246  -0.749136394"
"52346  -0.73265427167241  -0.71573082528382    -0.69837624940897  -0.68060099"
"779545  -0.66241577759017  -0.64383154288979   -0.62485948814239  -0.60551104"
"140433  -0.58579785745644  -0.56573181078361   -0.54532498842205  -0.52458968"
"267847  -0.50353838372572  -0.48218377207912    -0.46053871095824  -0.4386162"
"3853853  -0.41642956009764  -0.39399204006105    -0.37131719395184  -0.348418"
"68024943  -0.32531029216226  -0.30200594931923    -0.27851968938505  -0.25486"
"565960451  -0.23105810828067  -0.20711137619222    -0.18303988795514  -0.1588"
"5814333386  -0.13458070850713  -0.11022220729388    -0.08579731234444  -0.061"
"32073630221  -0.03680722294136  -0.01227153828572]"
      clipFlag		      "Warning"
    }
    Block {
      BlockType		      Scope
      Name		      "Synthedized Wave"
      Ports		      [1]
      Position		      [365, 14, 395, 46]
      Location		      [31, 190, 982, 389]
      Open		      off
      NumInputPorts	      "1"
      List {
	ListType		AxesTitles
	axes1			"%<SignalLabel>"
      }
      TimeRange		      "1e-009"
      YMin		      "-1"
      YMax		      "1"
      DataFormat	      "StructureWithTime"
    }
    Block {
      BlockType		      Display
      Name		      "Synthesized Frequency\nin Hz"
      Ports		      [1]
      Position		      [425, 180, 515, 210]
      Decimation	      "1"
    }
    Block {
      BlockType		      ToWorkspace
      Name		      "To Workspace"
      Position		      [355, 125, 415, 155]
      VariableName	      "simout"
      MaxDataPoints	      "1000000"
      SampleTime	      "-1"
      SaveFormat	      "Array"
    }
    Block {
      BlockType		      Clock
      Name		      "Clock1"
      Position		      [220, 445, 240, 465]
      IOType		      "siggen"
      Decimation	      "10"
    }
    Line {
      SrcBlock		      "Calculate  \nfrequency\n"
      SrcPort		      1
      DstBlock		      "Synthesized Frequency\nin Hz"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Pulse\nGenerator"
      SrcPort		      1
      Points		      [5, 0; 0, 30]
      DstBlock		      "Phase\nAccumulator"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Control\nWord"
      SrcPort		      1
      DstBlock		      "Phase\nAccumulator"
      DstPort		      2
    }
    Line {
      SrcBlock		      "RAM\nTable\n256"
      SrcPort		      1
      DstBlock		      "Analog\nFilter Design"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Phase\nAccumulator"
      SrcPort		      1
      DstBlock		      "RAM\nTable\n256"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Analog\nFilter Design"
      SrcPort		      1
      Points		      [0, 0; 20, 0]
      Branch {
	Points			[0, 30]
	Branch {
	  Points		  [0, 55]
	  DstBlock		  "Calculate  \nfrequency\n"
	  DstPort		  1
	}
	Branch {
	  DstBlock		  "To Workspace"
	  DstPort		  1
	}
      }
      Branch {
	Points			[0, -30]
	Branch {
	  Points		  [0, -50]
	  DstBlock		  "Synthedized Wave"
	  DstPort		  1
	}
	Branch {
	  DstBlock		  "Power Spectral\nDensity"
	  DstPort		  1
	}
      }
    }
    Annotation {
      Position		      [500, 20]
    }
  }
}

⌨️ 快捷键说明

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