Filter löschen
Filter löschen

Wrong colour mapping between graph and legend

2 Ansichten (letzte 30 Tage)
Nicola Caldognetto
Nicola Caldognetto am 18 Okt. 2021
I'm trying to visualize the 5G grid using the code
% PRINT GRAPH
chpLevel = struct();
chpLevel.PDSCH = 0.4;
chpLevel.DMRS = 1;
chpLevel.PTRS = 1.4;
chpLevel.CSI = 1.8;
grid = complex(zeros(carrier.NSizeGrid*12,carrier.SymbolsPerSlot,pdsch.NumLayers));
grid(pdschIndices) = chpLevel.PDSCH;
grid(dmrsIndices) = chpLevel.DMRS*dmrsSymbols;
grid(ptrsIndices) = chpLevel.PTRS*ptrsSymbols;
grid(csirsIndices) = chpLevel.CSI*csirsSymbols;
map = parula(64);
cscaling = 40;
im = image(cscaling*abs(grid(:,:,1)));
colormap(im.Parent,map);
% Add legend to the image
chpval = struct2cell(chpLevel);
clevels = cscaling*[chpval{:}];
N = length(clevels);
L = line(ones(N),ones(N), 'LineWidth',8); % Generate lines
% Index the color map and associated the selected colors with the lines
set(L,{'color'},mat2cell(map( min(1+clevels,length(map) ),:),ones(1,N),3)); % Set the colors according to map
% Create legend
fnames = {'PDSCH','DM-RS','PT-RS','CSI'};
legend(fnames{:});
axis xy
title('Carrier Grid Containing PDSCH, DM-RS and PT-RS')
xlabel('OFDM Symbols')
ylabel('Subcarriers')
The main issue is that the first three value of the legend ( 'PDSCH','DM-RS','PT-RS' ) have the correct matching between graph and legend color but 'CSI' stays blue on the graph and changes color only on the legend

Akzeptierte Antwort

Nicola Caldognetto
Nicola Caldognetto am 18 Okt. 2021
The issue was the CSI symbols where set all to zero

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by