
%%

OutputPort1 = InputPort1;           %Create an output structure similar to the input.


%Please Remove the % % in case the sampled signal time in the Frequency domain.

% % outsignalf = InputPort1.Sampled.Signal;
% % f = InputPort1.Sampled.Frequency;
% % signaltime = ifft (outsignalf);
% % Optisystem_signal = outsignalf;
% % 


%%
% Please Remove the %% in case the sampled signal time in the time domain.

outsignal = InputPort1.Sampled.Signal;
tau = InputPort1.Sampled.Time;
s = size (tau);
S1 = s(2);
dtau = tau (2);
fs = 1/(dtau*S1);
fc = InputPort1.Sampled.CentralFrequency;
fmax = fc + (fs* S1/2);
fmin = fc - (fs* S1/2);
f = (fmin:fs:fmax-fs);
outfsignal = fft (outsignal)./S1;
outsignalf = fftshift (outfsignal);
Matlab_sinal = outsignalf;

plot(tau,abs(outsignal).^2)
title('time domain')
ylabel ('power')
xlabel ('time')




%%
outsignalp = ((abs(outsignalf).^2));
outsignalpdbm = 10 * log10(10^3* outsignalp);

%%
figure
plot(f,outsignalpdbm,':r')
title('frequency domain')
title(max (outsignalpdbm))
ylabel ('power')
xlabel ('Frequency')
pause (10)