How can I plot a 3-D mesh using the colorbar as the 4th dimension?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to plot the results of a function with 3 input variables.
I have used meshgrid to form 3, 3-D 10x10x10 matrices.
x = linspace(190,245,10);
y = linspace(140,560,10);
z = linspace(0.5,2,10);
[X, Y, Z] = meshgrid(x,y,z)
I then have a number of functions which generate the result I want to plot, let's call it "K", also a 3-D 10x10x10 matrix.
In my mind, I have the idea of a 3-D area with X, Y and Z as the axes and the result K is represented by the colour bar. I could then slice through this surface at various points of the axis to investigate the results there. I've tried using sliceomatic, https://uk.mathworks.com/matlabcentral/fileexchange/764-sliceomatic, but am receiving the following error:
Error using axes
Value must be a 1x2 vector of numeric type in which the second element is
larger than the first and may be Inf
Error in sliceomaticfigure (line 45)
d.axmain = axes('units','normal','pos',[.2 .2 .6 .6],'box','on',...
Error in sliceomatic (line 200)
d = sliceomaticfigure(d,xmesh,ymesh,zmesh);
Does anyone know how to correct this error or have another suggestion for how I could plot my data? I've already amended the sliceomatic script as detailed in the comments on the file exchange.
Thank you!
0 commentaires
Réponses (1)
KSSV
le 27 Juil 2018
x = linspace(190,245,10);
y = linspace(140,560,10);
z = linspace(0.5,2,10);
[X, Y, Z] = meshgrid(x,y,z) ;
figure
hold on
for i = 1:10
surf(X(:,:,i),Y(:,:,i),Z(:,:,i),Z(:,:,i))
end
colorbar
2 commentaires
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!