- This topic has 1 reply, 1 voice, and was last updated 9 years, 3 months ago by Damian Marek.
-
AuthorPosts
-
-
October 13, 2015 at 11:14 am #26404Damian MarekParticipant
Attached is an amplitude modulator programmed in Matlab. The component accepts an optical signal and modulates its signal according to another electrical signal.
The optical signal can be any number of sampled signals centered at different central frequencies as well as including noise bins and parameterized signals. Depending on which type of input signal is present, the associated Matlab function will be called (AmplitudeModulatorNoise.m for noise).
-
October 13, 2015 at 2:17 pm #26434Damian MarekParticipant
Matlab code follows:
Main Component File:
global ModulationIndex
OutputPort1 = InputPort1; % create an output structure
ModulationIndex = Parameter0;
SampledNumber = length(InputPort1.Sampled);
ParameterizedNumber = length(InputPort1.Parameterized);
NoiseNumber = length(InputPort1.Noise);if( SampledNumber > 0 ) % if there is sampled signal do
for i=1:SampledNumber
OutputPort1.Sampled(i).Signal(1,:) = AmplitudeModulatorSampled(InputPort1.Sampled(i).Signal(1,:), real(InputPort2.Sampled.Signal))
PolarizationNumber = size(InputPort1.Sampled(i).Signal,1);
if( PolarizationNumber == 2)
OutputPort1.Sampled(i).Signal(2,:) = AmplitudeModulatorSampled(InputPort1.Sampled(i).Signal(2,:), real(InputPort2.Sampled.Signal));
end;
end
end;if( ParameterizedNumber > 0 ) %if there is parameterized signal do
for i=1:ParameterizedNumber
OutputPort1.Parameterized.Power = AmplitudeModulatorParameterized(InputPort1.Parameterized.Power, real(InputPort2.Sampled.Signal));
end
end;if( NoiseNumber > 0 ) %if there noise signal do
for i=1:NoiseNumber
OutputPort1.Noise.Power = AmplitudeModulatorNoise(InputPort1.Noise.Power, real(InputPort2.Sampled.Signal));
end
end;Modulate for Noise Bins:
function y = AmplitudeModulatorNoise( Noise, dModulation )
global ModulationIndex
nSize = length(dModulation);
dSum = 0;
dSum = dSum + sum( (1 – ModulationIndex) + ModulationIndex * dModulation );
dSum = dSum / nSize;
y = Noise * dSum;
Modulate for Parameterized Signals:
function y = AmplitudeModulatorParameterized(Parameterized, dModulation);
global ModulationIndex
nSize = length(dModulation);
dSum = 0;
dSum = sum( (1 – ModulationIndex) + ModulationIndex * dModulation );
dSum = dSum / nSize;
y = Parameterized * dSum;
Modulate for sampled signals:
function y = AmplitudeModulatorSampled(pccE, dModulation);
global ModulationIndex
nSize = length(pccE);
dModL = length(dModulation);resize = ones(1, nSize/dModL);
resize = kron(dModulation, resize);
resize(nSize+1:end) = [];for i = 1:nSize,
pccE(i) = pccE(i) * sqrt( (1 – ModulationIndex) + ModulationIndex * resize( i ) );
end;y = pccE;
-
-
AuthorPosts
- You must be logged in to reply to this topic.