fourier2.mdl

来自「关于电机的.m程序」· MDL 代码 · 共 625 行 · 第 1/2 页

MDL
625
字号
	DataLoggingDecimation	"2"
	DataLoggingLimitDataPoints off
	DataLoggingMaxPoints	"5000"
      }
    }
    Block {
      BlockType		      Clock
      Name		      "Clock"
      Position		      [15, 230, 35, 250]
      Decimation	      "10"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Fourier"
      Ports		      []
      Position		      [321, 261, 394, 304]
      BackgroundColor	      "yellow"
      DropShadow	      on
      ShowName		      off
      OpenFcn		      "fourierdec"
      ShowPortLabels	      off
      TreatAsAtomicUnit	      off
      MaskHelp		      "Fourier series decomposition"
      MaskDisplay	      "disp('FOURIER')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Fourier"
	Location		[148, 571, 512, 671]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	Annotation {
	  Name			  "To obtain the Fourier decomposition of a pe"
"riodic signal:\na) run a simulation for one period duration\nb) Specify the f"
"undamental frequency\n    c) Specify the number of harmonics\n"
	  Position		  [187, 48]
	  FontSize		  12
	}
      }
    }
    Block {
      BlockType		      Mux
      Name		      "Mux"
      Ports		      [2, 1]
      Position		      [55, 211, 60, 249]
      ShowName		      off
      Inputs		      "2"
      DisplayOption	      "bar"
    }
    Block {
      BlockType		      Mux
      Name		      "Mux2"
      Ports		      [2, 1]
      Position		      [315, 192, 320, 243]
      ShowName		      off
      Inputs		      "2"
      DisplayOption	      "bar"
    }
    Block {
      BlockType		      Scope
      Name		      "Scope"
      Ports		      [1]
      Position		      [375, 69, 405, 101]
      ShowName		      off
      Location		      [470, 109, 1101, 397]
      Open		      on
      NumInputPorts	      "1"
      List {
	ListType		AxesTitles
	axes1			"%<SignalLabel>"
      }
      List {
	ListType		SelectedSignals
	axes1			""
      }
      TimeRange		      "0.02"
      YMin		      "-1"
      YMax		      "1"
      DataFormat	      "StructureWithTime"
    }
    Block {
      BlockType		      Scope
      Name		      "Scope1"
      Ports		      [1]
      Position		      [375, 204, 405, 236]
      ShowName		      off
      Location		      [469, 461, 1102, 785]
      Open		      on
      NumInputPorts	      "1"
      List {
	ListType		AxesTitles
	axes1			"triangular carrier & sine waves"
      }
      List {
	ListType		SelectedSignals
	axes1			""
      }
      TimeRange		      "0.02"
      YMin		      "-1"
      YMax		      "1"
      DataFormat	      "StructureWithTime"
    }
    Block {
      BlockType		      Signum
      Name		      "Sign"
      Position		      [295, 70, 325, 100]
      Port {
	PortNumber		1
	Name			"pwm"
	TestPoint		off
	LinearAnalysisOutput	off
	LinearAnalysisInput	off
	RTWStorageClass		"Auto"
	DataLogging		off
	DataLoggingNameMode	"SignalName"
	DataLoggingDecimateData	off
	DataLoggingDecimation	"2"
	DataLoggingLimitDataPoints off
	DataLoggingMaxPoints	"5000"
      }
    }
    Block {
      BlockType		      Sum
      Name		      "Sum2"
      Ports		      [2, 1]
      Position		      [245, 75, 265, 95]
      ShowName		      off
      IconShape		      "round"
      Inputs		      "|+-"
    }
    Block {
      BlockType		      ToWorkspace
      Name		      "To Workspace"
      Position		      [375, 14, 405, 46]
      ShowName		      off
      VariableName	      "f"
      MaxDataPoints	      "inf"
      SampleTime	      "-1"
      SaveFormat	      "Array"
    }
    Block {
      BlockType		      ToWorkspace
      Name		      "To Workspace1"
      Position		      [270, 265, 300, 295]
      ShowName		      off
      VariableName	      "h"
      MaxDataPoints	      "1"
      SampleTime	      "-1"
      SaveFormat	      "Array"
    }
    Block {
      BlockType		      Gain
      Name		      "amplitude\nmodulation\nindex"
      Position		      [140, 71, 200, 99]
      NamePlacement	      "alternate"
      Gain		      "[0.8 4]"
    }
    Block {
      BlockType		      Gain
      Name		      "frequency\nmodulation\nindex"
      Position		      [155, 130, 185, 160]
      Gain		      "15"
    }
    Block {
      BlockType		      Constant
      Name		      "number of\nharmonics"
      Position		      [215, 265, 245, 295]
      BackgroundColor	      "yellow"
      Value		      "30"
    }
    Block {
      BlockType		      Constant
      Name		      "signal\nfrequency"
      Position		      [75, 130, 105, 160]
      Value		      "50"
    }
    Block {
      BlockType		      Fcn
      Name		      "triangular carrier"
      Position		      [75, 214, 220, 246]
      Expr		      "-2/pi*asin(sin(2*pi*u(1)*u(2)))"
      Port {
	PortNumber		1
	Name			"tri"
	TestPoint		off
	LinearAnalysisOutput	off
	LinearAnalysisInput	off
	RTWStorageClass		"Auto"
	DataLogging		off
	DataLoggingNameMode	"SignalName"
	DataLoggingDecimateData	off
	DataLoggingDecimation	"2"
	DataLoggingLimitDataPoints off
	DataLoggingMaxPoints	"5000"
      }
    }
    Line {
      SrcBlock		      "Sum2"
      SrcPort		      1
      DstBlock		      "Sign"
      DstPort		      1
    }
    Line {
      Name		      "pwm"
      Labels		      [0, 0]
      SrcBlock		      "Sign"
      SrcPort		      1
      Points		      [20, 0]
      Branch {
	DstBlock		"Scope"
	DstPort			1
      }
      Branch {
	Points			[0, -55]
	DstBlock		"To Workspace"
	DstPort			1
      }
    }
    Line {
      Name		      "sin"
      SrcBlock		      "50Hz sine Wave"
      SrcPort		      1
      DstBlock		      "amplitude\nmodulation\nindex"
      DstPort		      1
    }
    Line {
      SrcBlock		      "amplitude\nmodulation\nindex"
      SrcPort		      1
      Points		      [15, 0]
      Branch {
	DstBlock		"Sum2"
	DstPort			1
      }
      Branch {
	Labels			[-1, 1]
	Points			[0, 120]
	DstBlock		"Mux2"
	DstPort			1
      }
    }
    Line {
      Name		      "tri"
      SrcBlock		      "triangular carrier"
      SrcPort		      1
      Points		      [30, 0]
      Branch {
	DstBlock		"Sum2"
	DstPort			2
      }
      Branch {
	Labels			[1, 0]
	DstBlock		"Mux2"
	DstPort			2
      }
    }
    Line {
      SrcBlock		      "Mux2"
      SrcPort		      1
      DstBlock		      "Scope1"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Mux"
      SrcPort		      1
      DstBlock		      "triangular carrier"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Clock"
      SrcPort		      1
      DstBlock		      "Mux"
      DstPort		      2
    }
    Line {
      SrcBlock		      "signal\nfrequency"
      SrcPort		      1
      DstBlock		      "frequency\nmodulation\nindex"
      DstPort		      1
    }
    Line {
      SrcBlock		      "frequency\nmodulation\nindex"
      SrcPort		      1
      Points		      [10, 0; 0, 55; -160, 0]
      DstBlock		      "Mux"
      DstPort		      1
    }
    Line {
      SrcBlock		      "number of\nharmonics"
      SrcPort		      1
      DstBlock		      "To Workspace1"
      DstPort		      1
    }
    Annotation {
      Name		      "Sinusoidal PWM signal"
      Position		      [99, 15]
      ForegroundColor	      "red"
      FontSize		      14
      FontWeight	      "bold"
      FontAngle		      "italic"
    }
  }
}

⌨️ 快捷键说明

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