setsparameter - Script command
Sets the s-parameters between output port and input port.
IMPORTANT: the filter transfer function depends on the sample rate when providing filter coefficients.
Syntax |
Description |
---|---|
setsparameter("output_port", "input_port", "constant", value); |
Sets the s-parameter between "output_port" and "input_port" as a single complex constant value (frequency independent). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "constant", value); |
Sets the s-parameter between "output_port" and "input_port" as a single complex constant value (frequency independent). "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port", "input_port", "transmission", transmission); |
Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assume that the angle values are zero. |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "transmission", transmission); |
Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assume that the angle values are zero. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "transmission", transmission, delay, fractional delay, delay compensation); |
Sets the s-parameter between "output_port" and "input_port", where the transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad). The number of rows of the matrix is the number of frequency points. If only two columns are provided, it is assumed that the angle values are zero. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). Delay is the filter delay defined in seconds. Fractional delay is a boolean value which defines whether to enable the fractional delay option for the function. Delay compensation is the compensation number. |
setsparameter("output_port", "input_port", "propagation", propagation, length, digital, fractional delay, delay compensation); |
Sets the frequency dependent propagation parameters between "output_port" and "input_port", where the propagation is a matrix with up to 6 columns: frequency (Hz), absorption (dB/m), effective index, group velocity (m/s), dispersion (s/m/m), dispersion slope (s/m^2/m) and digital filter. The number of rows of the matrix is the number of frequency points. Group velocity, dispersion, dispersion slope and digital filter are optional. The length (m) is the propagation length. Digital is a boolean value which defines whether the model will use a FIR filter or not (default is true). Fractional delay is a boolean value which defines whether to enable the fractional delay option for the propagation. Delay compensation is the compensation number. |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "propagation", propagation, length, digital, fractional delay, delay compensation); |
Sets the s-parameter between "output_port" and "input_port", where the propagation is a matrix with up to 6 columns columns: frequency (Hz), absorption (dB/m), effective index, group velocity (m/s), dispersion (s/m/m) , dispersion slope (s/m^2/m) and digital filter. The number of rows of the matrix is the number of frequency points. Group velocity, dispersion, dispersion slope and digital filter are optional. The length (m) is the propagation length. Digital is a boolean value which defines whether the model will use a FIR filter or not (default is true). Fractional delay is a boolean value which defines whether to enable the fractional delay option for the propagation. Delay compensation is the compensation number. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","mode_label", output_mode_ID, "input_port", input_mode_ID, "s coefficient", coeff, frequency); |
Sets the s-parameter between "output_port" and "input_port", using ‘s’ domain coefficients. coeff is a matrix with 2 columns: complex numerators and complex denominators. The number of rows of the matrix is the number of coefficients points. If the number of numerators are different from the number of denominators, set the missing values to zero. frequency is the center frequency of the transmission described by the coefficients. Coefficients are the terms of the polynomial and increase in powers of s. "output_mode_ID" and "input_mode_ID" are numbers (i.e., 1, 2, 3...). |
setsparameter("output_port","input_port", "s-coefficient", coeff, frequency); |
Sets the s-parameter between "output_port" and "input_port", using ‘s’ domain coefficients. coeff is a matrix with 2 columns: complex numerators and complex denominators. The number of rows of the matrix is the number of coefficients points. If the number of numerators are different from the number of denominators, set the missing values to zero. frequency is the center frequency of the transmission described by the coefficients. Coefficients are the terms of the polynomial and increase in powers of s. |
Example
Below is a simple example of the usage of the 'transmission' option, where the user can enter the transmission for different modes. The transmission is a matrix with 3 columns: frequency (Hz), amplitude and angle (rad).
#setsparameter("output_port","mode_label",output_mode_ID,"input_port",input_mode_ID,"transmission",transmission); trans = matrix(5,3); #column 1, defines the frequency points trans(1,1) = 187370286250000.0; trans(2,1) = 190493124354166.7; trans(3,1) = 193615962458333.3; trans(4,1) = 196738800562500.0; trans(5,1) = 199861638666666.7; #column 2, defines the transmission amplitude trans(1,2) = 0.03518825476359812; trans(2,2) = 0.03383507116538854; trans(3,2) = 0.03492134747865309; trans(4,2) = 0.02838844090444738; trans(5,2) = 0.02130194150641888; #column 3, defines the transmission phase trans(1,3) = -1.433937989007260; trans(2,3) = -0.5088708644443268; trans(3,3) = 0.8736840958416258; trans(4,3) = 2.047612541197649; trans(5,3) = 4.695289185212291; setsparameter("port 2", "TE", 1, "port 1", 1, "transmission", trans);
Below is a simple example of the usage of the 'coefficient' option, where the user can enter z-transform numerator and denominator complex coefficients directly. User should provide the complex coefficients and the center frequency. If the number of numerators and denominators are different, simply provide zero values for the missing coefficients.
trans = matrix(5,2); #numerator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of z (increase in powers of 1/z) trans(1,1) = 0.0016146343489959229; trans(2,1) = 0.0064585373959836915; trans(3,1) = 0.0096878060939755359; trans(4,1) = 0.0064585373959836915; trans(5,1) = 0.0016146343489959229; #denominator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of z (increase in powers of 1/z) trans(1,2) = 1.0000000000000000; trans(2,2) = 2.6335032369252369; trans(3,2) = -2.6909323201054560; trans(4,2) = 1.2572856503799887; trans(5,2) = -0.22569071678370439; setsparameter("port 2", "port 1", "coefficients", trans, frequency ); setsparameter("port 1", "port 2", "coefficients", trans, frequency );
Below is a simple example of the usage of the 'propagation' option, which is most useful when setting the s-parameter for waveguides. User can define the propagation length and propagation parameters like the central frequency, absorption, effective index, group velocity and so on.
prop = matrix(1,5); #define the propagation parameters prop(1,1) = 193.1e12; #central frequency prop(1,2) = 11; #absorption prop(1,3) = 2.1; #effective index prop(1,4) = 74948114.5; #group velocity prop(1,5) = 90e-6; #dispersion setsparameter("port 2", "port 1", "propagation", prop, 1e-5, true );
Below is a simple example of the usage of the 's coefficient' option. It models the filter coefficients for proportional integral derivative controller (PID), L(s)= kd.s + kp + ki/s.
trans = matrix(3,2); #numerator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of s (increase in powers of 1/s) trans(1,1) = kd; trans(2,1) = kp; trans(3,1) = ki; #denominator coefficients (real or complex) - with the constant terms of the polynomial and decrease #in powers of s (increase in powers of 1/s) trans(1,2) = 0; trans(2,2) = 1; trans(3,2) = 0; setsparameter("output", "input", "s coefficients", trans, 0.0 );
See Also