updates of framework
- focus on AWG output power and lowpass characteristics
This commit is contained in:
40
Functions/plot_eye.m
Normal file
40
Functions/plot_eye.m
Normal file
@@ -0,0 +1,40 @@
|
||||
function plot_eye(signal, fs, fsym)
|
||||
|
||||
|
||||
histpoints = 512; %% verticale resolution
|
||||
histpoints = floor(histpoints/2)*2+1; %% to have the eye digram centered around one point make the vertical resolution uneven
|
||||
histpoints_horizontal = 256; %% horizontal resolution
|
||||
hist_data=zeros(histpoints,histpoints_horizontal ); %% initilize eye diagram
|
||||
x = real(signal); %% make input signal real
|
||||
|
||||
x = resample(x,fsym*histpoints_horizontal/2,fs); %% down sample to original fsym rate
|
||||
if mod(length(x),2)==1 %% if the signal lenght is not divisible by 2 (symbols displayed in the eye diagram are 2) remove last symbol
|
||||
x = x(1:end-1);
|
||||
end
|
||||
|
||||
%x = resample(x,histpoints_horizontal/2,1); %% reshape signal to high resolution eye diagram in this case 2 symbols are upsampled to 512 values
|
||||
eye_mat = reshape(x(1:end-mod(length(x),histpoints_horizontal)),histpoints_horizontal,floor(length(x)/histpoints_horizontal)); %% reshape signal into 256 rows each row has the histogram(eye data of all symbols)
|
||||
|
||||
%defult value case
|
||||
maxA = max(eye_mat(:))*1.1;
|
||||
minA = min(eye_mat(:))*1.1;
|
||||
|
||||
difference= maxA-minA;
|
||||
|
||||
data_ind_y=round((eye_mat-minA)/difference*(histpoints-1)) +1;
|
||||
|
||||
for n=1:size(data_ind_y,1)
|
||||
[nn,cc] = hist(data_ind_y(n,:),1:histpoints);
|
||||
hist_data(:,n)=hist_data(:,n)+nn.';
|
||||
end
|
||||
|
||||
figure;
|
||||
image(hist_data);
|
||||
colormap(cbrewer2("Reds",92));
|
||||
|
||||
y = string(linspace(minA,maxA,16));
|
||||
yticks(linspace(0,histpoints,16));
|
||||
yticklabels(y);
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user