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

 Réponse acceptée

madhan ravi
madhan ravi le 13 Déc 2018
Modifié(e) : madhan ravi le 13 Déc 2018
contourf(LAT,D,repmat(T,1,numel(D)),20); % or repmat(T,1,numel(D))' if that doesn't work

2 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by