Below I have a small code which outputs an image from a simulation. The image I get will have an arbitrary axis for intensity, which I would love to have scaled to be between values of 0 and 1.
How can I achieve this?
Ex = reshape(csvread('gif240psex.td2', 23), 101, 101, []);
Ey = reshape(csvread('gif240psey.td2', 23), 101, 101, []);
pcolor(mean(abs(Ex).^2 + abs(Ey).^2, 3))
shading interp
title('VCSEL Intensity Graph')
xlabel('x-Length (μm)')
ylabel('y-Length (μm)')
colormap(jet)
colorbar

 Respuesta aceptada

Riccardo Scorretti
Riccardo Scorretti el 6 de Mayo de 2022

0 votos

I think you have to rescale the plotted quantity. That is:
val = mean(abs(Ex).^2 + abs(Ey).^2, 3);
val = val / max(val(:));
pcolor(val);

3 comentarios

Riccardo Scorretti
Riccardo Scorretti el 6 de Mayo de 2022
If it doesn't work, share your data so mi or someone else can check where is the problem.
Christopher McDwyer
Christopher McDwyer el 6 de Mayo de 2022
Hi Riccardo,
That suggestion worked perfectly, thank you so much!
Riccardo Scorretti
Riccardo Scorretti el 6 de Mayo de 2022
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by