MATLAB: 3D plot isocolor

3d plots

Hi,
I’m new to matlab and I am trying to make a 3D plot of an equation created from experimental design 3^2 modelling determined from leaching experiments to show the optimisation direction.
The equation is Metal Extraction =1.95+(0.94/2)*A+(0.13/2)*B+(0.40/2)*AC
Where A can be x, B can be y and C can be z.
I have read a few answers and tried isocolors to get a plot using the example from tutorial page, which works for values 1 to 20, but when I use the values from -1 to 1 it comes up with a blank plot.
Could someone please help me in graphing my equation.
[x,y,z] = meshgrid(-1:1,-1:1,-1:1);
data = 1.95+(0.94/2).*x+(0.13/2).*y+(0.40/2).*x.*z ;
cdata = smooth3(rand(size(data)),'box',7);
p = patch(isosurface(x,y,z,data,10));
isonormals(x,y,z,data,p)
isocolors(x,y,z,cdata,p)
p.FaceColor = 'interp';
p.EdgeColor = 'none';
view(150,30)
daspect([1 1 1])
axis tight
camlight
lighting gouraud
I have plotted the equation in excel, but I have to make one variable equal to 1 to get any graphs.
Thanks for the assistance.

Best Answer

It is because there is no such value as data=10 for those intervals you set
[x,y,z] = meshgrid(-1:1,-1:1,-1:1);
data = 1.95+(0.94/2).*x+(0.13/2).*y+(0.40/2).*x.*z ;
p = patch(isosurface(x,y,z,data,10)); % try 2 instead of 10
Also [-1:1] interval is only 3 values
>> -1:1
ans =
-1 0 1
Related Question