Making a contour map using a 3D matrix

13 views (last 30 days)
Bugce Gokce
Bugce Gokce on 11 Jun 2020
Commented: Bugce Gokce on 11 Jun 2020
i have 3d matrix. this matrix size is 247x3x96.
247 means total point number.
3 means point of latitude longitude and precipitation value of this point.
96 means epoch(so every 15 minutes during the day (a total of 96) I have a precipitation value for the relevant points.).
I want to draw a contour precipitation map for each epoch using the data of this matrix. (Or if I need to rearrange the matrix for this purpose, how should I do it? then how should I draw the contour map)
how can i do this?, i'm waiting for your help!
------------------------------------------------------------------------------------
note: I could not use the contour command with the 3D matrix.
>> contour(vq(:,1,:),vq(:,2,:),vq(:,3,:))
Error using contour (line 46)
Input arguments must have at most 2 dimensions.
---------------------------------------------------------------------
>> contour3(vq(:,1,:),vq(:,2,:),vq(:,3,:))
Error using contour3 (line 42)
Input arguments must have at most 2 dimensions.
---------------------------------------------------------------
>> contour3(vq(:,1,1),vq(:,2,1),diag(vq(:,3,1)))
Error using contour3 (line 44)
Vector X must be strictly increasing or strictly decreasing with no repeated values.
-----------------------------------------------------------
>> scatter3(vq(:,1,:),vq(:,2,:),vq(:,3,:))
Error using scatter3 (line 64)
X, Y and Z must be vectors of the same length.

Answers (1)

darova
darova on 11 Jun 2020
try this
m = size(vq,1);
n = size(vq,3);
[x,y] = meshgrid(1:m,1:n);
cla
hold on
for i = 1:3
contour(x,y,vq(:,i,:));
end
hold off
  1 Comment
Bugce Gokce
Bugce Gokce on 11 Jun 2020
I get this error:
Error using contour (line 46)
Input arguments must have at most 2 dimensions.

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!