How to plot a variable with 3 dimensions.

1 次查看(过去 30 天)
So the title doesn't really explain it very well, here is the script so far,
close all
clear all
clc
load colormap_anom.mat;
Global68=read_one_netcdf('ETOPO_dx_dy.nc');
LIG6=read_one_netcdf('ETOPO_LIG6_1y_ptrc_Y2600.nc');
LIG8=read_one_netcdf('ETOPO_LIG8_1y_ptrc_Y2600.nc');
depth=LIG6.deptht*(-1);
LIG6.Fer(find(LIG.Fer>1e4))=NaN;
LIG6Fe=LIG6.Fer*1000;
LIG8.Fer(find(LIG.Fer>1e4))=NaN;
LIG8Fe=LIG8.Fer*1000;
Feglobal68=(LIG6Fe-LIG8Fe);
I now want to plot Feglobal68 however it is three dimensions (360,180,31) so I can't. I want to plot it over the whole globe, so something like this,
contourf(Feglobal68(:,:,1));
However I don't want it to just be at the surface (',1), so next I've tried to add up the Feglobal68 at every depth level, at each coordinate and then plot that as so;
TotalFe=zeros(360,180,31)
for i=1:360
j=1:180
k=1:31
TotalFe(i,j,k)=Feglobal68(i,j,k)+Feglobal68(i,j,(k+1));
end
end
end
However it says 'index exceeds matrix dimensions'
Any ideas?
Thanks,
Alexandra

回答(1 个)

Kaushik Lakshminarasimhan
Even if you get Matlab to make a dense 3d plot, you cannot see through the surface so it might be futile. One alternative is to create a Matlab UI with a slider that allows you to select the depth level and plots the corresponding surface contour.
  1 个评论
Alexandra Ridgway
Alexandra Ridgway 2017-2-16
I just want one final depth layer to plot but which has all the iron values from every depth layer added up so there is just one number to plot at the top...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by