pdeplot with same colorbar range

I am trying to plot the results of solving the transient heat equation. I want to use pdeplot to show the temperature distribution at a few different times. However, I want the color scale to be the same for each time, i.e. I want it to vary from 0 to 76. The different color scales currently can be misleading (see image)...
Here are the lines of code:
figure;
subplot(3,1,1)
pdeplot(model,"XYData",u(:,1),"Contour","on", "ColorMap","jet")
subplot(3,1,2)
pdeplot(model,"XYData",u(:,12),"Contour","on", "ColorMap","jet")
subplot(3,1,3)
pdeplot(model,"XYData",u(:,50),"Contour","on", "ColorMap","jet")
I have tried to update the axis' with:
axis([-inf inf -inf inf 0 76])
but this is not right. I'm not easily seeing from the pdeplot documentation how to do this... Any suggestions?
Thanks

 Respuesta aceptada

Chunru
Chunru el 28 de Nov. de 2023
Use clim for each subplot.
figure;
subplot(3,1,1)
pdeplot(model,"XYData",u(:,1),"Contour","on", "ColorMap","jet")
clim([0 76])
subplot(3,1,2)
pdeplot(model,"XYData",u(:,12),"Contour","on", "ColorMap","jet")
clim([0 76])
subplot(3,1,3)
pdeplot(model,"XYData",u(:,50),"Contour","on", "ColorMap","jet")
clim([0 76])

3 comentarios

Hi @Chunru. It seems when I do that the following error is thrown.
Undefined function 'clim' for input arguments of type 'double'.
Chunru
Chunru el 28 de Nov. de 2023
You may use an older version of matlab.
Try use caxis([0 76]) instead.
Paul Safier
Paul Safier el 28 de Nov. de 2023
@Chunru, that worked, thanks! I am using version 2021b, so maybe too old for the clim command in this context. Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2021b

Preguntada:

el 27 de Nov. de 2023

Comentada:

el 28 de Nov. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by