我参考了这篇博文,“Using MATLAB with UnetStack3”([https://blog.unetstack.net/using-matlab-with-unetstack3][1]),并在传输部分添加了序言:
% load the baseband signal
% signal.txt contains interleaved real and imaginary values in a single column
% with values normalized between +1 and ‐1
x = load('signal.txt');
% open the modem gateway
modem = org.arl.fjage.remote.Gateway('192.168.0.42', 1100);
% subscribe to the agent providing baseband service
bb = modem.agentForService(org.arl.unet.Services.BASEBAND);
% create the message with relevant attributes to be sent to the modem
msg = org.arl.unet.bb.TxBasebandSignalReq();
msg.setPreamble(3); % add preamble
msg.setSignal(x);
msg.setRecipient(bb);
% send the message to modem
rsp = modem.request(msg, 1000);
% check if the message was successfully sent
if isjava(rsp) && rsp.getPerformative() == org.arl.fjage.Performative.AGREE
cls = org.arl.unet.phy.TxFrameNtf().getClass();
% receive the notification message
ntf = modem.receive(cls, 5000);
end
看起来效果不错,但是如何修改接收端代码:
% subscribe to the agent providing the baseband service
agent = modem.agentForService(org.arl.unet.Services.BASEBAND);
modem.subscribe(agent);
% create the message with relevant attributes to be sent to the modem
req = org.arl.unet.bb.RecordBasebandSignalReq();
req.setRecipient(agent);
% send the message to the modem and wait for the response
rsp = modem.request(req, 5000);
% check if the message was successfully sent
if isjava(rsp) && rsp.getPerformative() == org.arl.fjage.Performative.AGREE
% receive the notification message containing the signal
cls = org.arl.unet.bb.RxBasebandSignalNtf().getClass();
ntf = modem.receive(cls, 5000);
end
% plot the recorded signal
plot(ntf.getSignal())
为了开启basebandRx能力,检测前导码,捕获指定长度的信号? [1]:https://blog.unetstack.net/using-matlab-with-unetstack3