Example_UploadPredefinedProfile.m
Example_UploadProfile.m
addpath
(
'WSMethods'
)
% Define device IP
ip
=
'169.254.6.8'
;
% Define profile according to API
profileType
=
'bandpass'
;
% blockall, transmit, bandpass, bandstop, gaussian
centerFreq
=
194.000
;
% THz
bandwidth
=
1
;
% THz
attenuation
=
0
;
% dB
port
=
1
;
% Upload predefined profile using above definition
r
=
uploadPredefinedProfile
(
ip
,
profileType
,
centerFreq
,
bandwidth
,
attenuation
,
port
);
addpath
(
'WSMethods'
)
% Define device IP
ip
=
'169.254.6.8'
;
% GET device info and decode JSON
result
=
webread
([
'http://'
,
ip
,
'/waveshaper/devinfo'
]);
result
=
jsondecoder
(
result
);
% Set frequency variables from device info
s
=
result
.
startfreq
;
e
=
result
.
stopfreq
;
% Create data for wsp
wsFreq
=
linspace
(
s
,
e
,
(
e
-
s
)
/
0.001
+
1
);
wsAttn
=
50
*
sin
(
2
*
pi
/
0.5
*
(
wsFreq
-
193
))
.^
2
;
wsPhase
=
zeros
(
size
(
wsFreq
));
wsPort
=
ones
(
size
(
wsFreq
));
% Upload profile using created data
r
=
uploadProfile
(
ip
,
wsFreq
,
wsAttn
,
wsPhase
,
wsPort
);
WaveShaper A Series User Manual
40