What format should my Z values be when making a contour plot?

Hey everyone. hope you're doing good. I'm trying to display temperature variations in a fjord in a two dimensional space. The X axis is the latitude of the sample and the Y axis is the depth at which the temperature was measured.
This is my code:
CTD = xlsread('komplett_CTD.xlsx');
LAT = CTD(:,6);
D = CTD(:,8);
T = CTD(:,9);
contour(LAT,D,T);
set(gca,'Ydir','reverse')
"CTD" is a 579x20 double, so "LAT", "D" and "T" are 579x1 doubles.
here's the error message:
Error using contourf (line 57)
Z must be at least a 2x2 matrix.
Error in Profiler (line 18)
contourf(LAT,D,T,20);
I don't know where to go from here. If the Z values are coupled with each respective X,Y-pair, then why can't Z be just a nx1 double? How can i turn it into the correct format?
Thankful for answers. /Max

 Respuesta aceptada

madhan ravi
madhan ravi el 13 de Dic. de 2018
Editada: madhan ravi el 13 de Dic. de 2018
contourf(LAT,D,repmat(T,1,numel(D)),20); % or repmat(T,1,numel(D))' if that doesn't work

2 comentarios

My gosh, this helped! I am very grateful. Thank you.
Anytime :)

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 13 de Dic. de 2018

Comentada:

el 14 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by