Home › Forums › SYSTEM › How to modulate RF signal generated by MATLAB onto the optical carrier with MZM
- This topic has 1 reply, 2 voices, and was last updated 2 weeks, 2 days ago by
Saurabh Bedi.
-
AuthorPosts
-
-
January 22, 2025 at 10:45 pm #89068
Guanzalo Chen
ParticipantI have written a matlab program that first converts the binary stream generated by the Bit Sequence Generator into a decimal number ranging from 1 to 32 for every 5 bits based on the coming bit stream. Then, the program generates one RF signal (or possibly a combination of two RF signals) based on the corresponding decimal number, then this RF signal modulates the lightwave by a MZM Modulator, to reach the receiver. However, the MATLAB always fails to interface with OptiSystem to drive the MZM to work (i.e., fail to modulate the RF signal onto the optical carrier). How should I resolve this issue? What codes do I need to add to this MATLAB program to make it drive the MZM? (the following is my Matlab codes). Thanks~
———————————————————————————————
% Generate 8 sine signals with different frequencies
fs = 1e12; % Sampling frequency (1 THz)
t = 0:1/fs:1e-9; % Time vector (1 ns)
frequencies = linspace(10e9, 80e9, 8); % Generate 8 different frequencies from 10 GHz to 80 GHz
sin_signals = arrayfun(@(f) sin(2*pi*f*t), frequencies, ‘UniformOutput’, false); % Generate sine signals% Eight-to-one selection
one_select = 1:8;% Eight-to-two selection (discard four cases)
two_select = nchoosek(1:8, 2);
two_select = two_select(1:24, :); % Discard four cases% Randomly send a five-bit binary number through OptiSystem
% Here, MATLAB’s built-in function is used to simulate
binary_num = randi([0, 1], 1, 5); % Randomly generate a five-bit binary number% Convert the binary number to decimal and add one
decimal_num = bi2de(binary_num) + 1;% Output the corresponding sine signal for eight-to-one and eight-to-two cases
if decimal_num <= 8
disp([‘Eight-to-one case: Number ‘, num2str(one_select(decimal_num)), ‘ corresponds to the sine signal frequency of ‘, num2str(frequencies(decimal_num)/1e9), ‘ GHz’]);
plot(t*1e9, sin_signals{one_select(decimal_num)});
title([‘Eight-to-one case: Number ‘, num2str(one_select(decimal_num)), ‘ sine signal’]);
xlabel(‘Time (ns)’);
ylabel(‘Amplitude’);
else
disp([‘Eight-to-two case: Numbers ‘, num2str(two_select(decimal_num-8, 1)), ‘ and ‘, num2str(two_select(decimal_num-8, 2)), ‘ correspond to the sine signal frequencies of ‘, num2str(frequencies(two_select(decimal_num-8, 1))/1e9), ‘ GHz and ‘, num2str(frequencies(two_select(decimal_num-8, 2))/1e9), ‘ GHz’]);
subplot(2, 1, 1);
plot(t*1e9, sin_signals{two_select(decimal_num-8, 1)});
title([‘Eight-to-two case: Number ‘, num2str(two_select(decimal_num-8, 1)), ‘ sine signal’]);
xlabel(‘Time (ns)’);
ylabel(‘Amplitude’);
subplot(2, 1, 2);
plot(t*1e9, sin_signals{two_select(decimal_num-8, 2)});
title([‘Eight-to-two case: Number ‘, num2str(two_select(decimal_num-8, 2)), ‘ sine signal’]);
xlabel(‘Time (ns)’);
ylabel(‘Amplitude’);
end -
January 27, 2025 at 1:58 pm #89073
Saurabh Bedi
ModeratorHello,
Thanks for reaching out to us.
Looking at your code, I can see that you are generating 8 sine signals with different frequencies and then you are processing those signals to convert the binary to decimal. And you want to apply this processed signal to modulate the MZM.
In order to do that, you need to use a matlab component in between your input signal (bit source) and the MZM and you need to define the input signal inside your matlab code from the OptiSystem. You can look at the OSA example in order to understand how to define the output port signal (the processed signal in your case) in relation to the input bit signal. You will have to change your matlab code accordingly in order to make OptiSystem interface properly with MATLAB. The example can be found at: C:\Users\USERNAME\Documents\OptiSystem 22.0 Samples\Software interworking\MATLAB co-simulation\OSA example
Feel free to look at the other examples for matlab co-simulation (BER analyzer example) at: C:\Users\USERNAME\Documents\OptiSystem 22.0 Samples\Software interworking\MATLAB co-simulation, in order to understand how to write the code for the matlab component.
Also, to understand how to deal with the Optical, Electrical and binary data formats for the signals, have a look at the document at the location: C:\Users\USERNAME\Documents\OptiSystem 22.0 Samples\Software interworking\MATLAB co-simulation\OptiSystem MATLAB data model
I hope this helps?
Warm Regards,
Saurabh Bedi
-
-
AuthorPosts
- You must be logged in to reply to this topic.