Matlab Electrical Example PDF
Matlab Electrical Example PDF
(a)
(b)
(c)
Figure 1: System layout and optical signal in frequency domain (spectrum) and time domain.
Using the MATLAB Library, we can add a Matlab component to the layout. By clicking on the
component properties, on the Main tab, you can choose the Sampled Signal in the time or frequency
domain. The number of inputs and outputs ports and also the format of these signals (Optical/Electrical)
can be defined in the Inputs and Outputs tab. The User Parameter tab is used to define the input
parameters of the component. The system layout and the Matlab component properties are shown in
Figure 2.
Figure 3 shows the structure of the launched signal in the Matlab workspace. Each signal is
defined by the sampled signal structure and the noise structure, however since there is no noise source in
this example, the noise values are zero.
Figure 4: Sampled signal structure for the signal in frequency and time domain.
Unlike optical signals, the electrical sampled structure has only one dimension and all electrical
signals are allocated in the same structure. In the following example, two electrical signals are generated
and launched into the same input port. Figure 5 demonstrates the system layout.
(a)
(b)
Figure 6: Electrical signal in the (a) spectrum domain and (b) time domain.
Figure 7: Structure launched into the workspace and electrical sampled signal structure.
Electrical Individual Sample Signal Individual samples allow users to simulate time-driven systems in
the electrical and optical domain. By using it, users can create designs that have closed loops and
feedbacks. To convert an electrical sampled signal to Individual sample signals, the component Convert
To Electrical Individual Samples (Signal Processing Library/Tools/Electrical) can be used. The system
layout that launches electrical Individual samples into Matlab is presented in Figure 8.
(a)
(b)
Figure 9: (a) Signal structure launched into the workspace, (b) Individual sample structure.
1.1
Matlab program:
Based on the signal structure, an electrical attenuator is implemented using the Matlab
component. In this case the matlab component is set to have one input port and one output port for
electrical signals. The Matlab program (m-file) that will simulate the attenuator is named
ElectricalAttenuator and that is the command at Run command parameter field. To be able to run this
program, the path for this file must be in the Matlab search path, in this example the
ElectricalAttenuator.m is located at c:\temp.
In order to see the file structure and the m-file, go to the Matlab component properties, on the
main tab, check Load Matlab box and click OK. This will open the Matlab Command Window. In this
window, first choose the code directory by cd (c:\temp) command. Using the command open
ElectricalAttenuator.m, you can open the m-file in the Matlab Editor. The command workspace opens
the Matlab workspace.
The only parameter necessary for this component is the attenuation constant, which can be
defined by the Parameter0 in the User Parameters tab. More parameters can be added by using Add
Parameter button.
After defining the Matlab component properties, you can start writing the program (Matlab code)
that simulates the electrical attenuator. Following is the Matlab code:
In this example, the code was written for the Sampled, Noise and IndividualSample, however,
according to the application, the user can define those ones required for the simulation, e.g. Sampled
signal.
In order to see the file structure in the Matlab workspace (Figure 3), first you need to run the
OptiSystem program, then use the command open InputPort1in the Matlab Command Window, to see
the file structure for each port. The command workspace opens the Matlab workspace.
Please refer to the Creating a component to handle optical signals application note for the
instructions of the Matlab debug mode.
Optiwave
7 Capella Court
Ottawa, Ontario, K2E 7X1, Canada
Tel.: 1.613.224.4700
Fax: 1.613.224.4706
E-mail: support@optiwave.com
URL: www.optiwave.com
Forum: www.optiwave.us