Commit ecf2065f authored by John, Fabian's avatar John, Fabian
Browse files

added new lib functions

parent 681f564e
function [pulse] = generate_uwbpulse(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [pulse] = generate_uwbpulse(frequency, bandwidth, time, cutofftime)
% Function to create an UWB pulse based on frequency, bandwidth, timevector
% and cutofftime
%
% Input: frequency - Center Frequency
% bandwidth - Transmission Bandwidth (ideal)
% time - given time-vector for the pulse
% cutofftime - pulse oscillations only to given time (optional)
%
% Output: pulse - UWB pulse matching "time"
%
% v1.0 - SOS
% 25th January 2021
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Init Variables
frequency = varargin{1};
bandwidth = varargin{2};
time = varargin{3};
if size(varargin,2)==4 && ~isempty(varargin{4})
cutofftime = varargin{4};
end
%% Calculate UWB Pulse
pulse = sinc(time*bandwidth);%.* sin(2*pi*frequency*time);
%% Remove obsolete pulse oscillations
if exist('cutofftime')
pulse(cutofftime<abs(time)) = 0;
end
end
\ No newline at end of file
function rp_sig_gen_arb(mqtt_handler, broker_ip, rp_name, ch, f, magnitude, offset, phase_deg, burst_cnt, arb_signal)
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/DISABLE", "1");
pause(.1);
mqtt_handler.pub_mqtt_binary(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/WAVE/ARB", arb_signal);
pause(.1);
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/FREQUENCY", num2str(f));
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/AMPLITUDE", num2str(magnitude));
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/OFFSET", num2str(offset));
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/PHASE", num2str(phase_deg));
if burst_cnt > 0
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/BURST", num2str(burst_cnt));
else
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/CONINUOUS", "1");
end
pause(.1);
mqtt_handler.pub_mqtt(broker_ip, rp_name + "/CONFIGURE/AO/" + ch + "/ENABLE", "1");
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment