Someone that can help me with 3D graph?
Show older comments
Hi, I'm Pablo, I'm starting with this fantastic program and now I wanted to make some graphs of surface .... I want to represent the values of a virus (z), depending on the temperature (x) and pH (y), I have tried different interpolations... the one that works best for me is v4, but the z values represented were higher than the limits of my vector, when I have marked the limits that I want to represent there is an abrupt cut in the surface, when I have solved it, and I add the z points in the surface, I see that the z data do not correspond to the temperature (x) and pH (y) that I had in my data set...I understand that it is because of small errors in the interpolation.... could someone help me to make the surface graph correctly? I attach the data in the form of column vectors. Thanks in advance
x=[ 13.6 11.3 9.7 9.3 10.6 9.8 25.6 28.2 31.4 28.2 28.6 29.2 17.9 16.7 17.1 22 19.3 17.1 7.4 7.6 7.3 9.7 9.6 15.6 14.6 15.8 15 13.4 ];
y=[ 6.77 7.2 6.83 6.69 6.76 6.67 7.87 7.87 7.84 7.98 8.33 7.78 8.03 7.99 8.02 8 8.03 8 6.68 6.24 5.84 7.26 6.5 7.97 8.24 8.03 7.9 7.97 ];
z=[ 2.31 1.71 3.52 2.45 2.6 1.89 4.59 3.87 3.47 2.85 2.17 3.47 6.44 5.86 3.91 5.71 3 3.57 3.1 3.01 3.29 3.8 2.94 5.72 4.26 4.05 5.24 6.55 ];
1 Comment
Pablo
on 10 Nov 2024
Moved: Walter Roberson
on 10 Nov 2024
Accepted Answer
More Answers (1)
It is not a nice surface.
x=[ 13.6 11.3 9.7 9.3 10.6 9.8 25.6 28.2 31.4 28.2 28.6 29.2 17.9 16.7 17.1 22 19.3 17.1 7.4 7.6 7.3 9.7 9.6 15.6 14.6 15.8 15 13.4 ];
y=[ 6.77 7.2 6.83 6.69 6.76 6.67 7.87 7.87 7.84 7.98 8.33 7.78 8.03 7.99 8.02 8 8.03 8 6.68 6.24 5.84 7.26 6.5 7.97 8.24 8.03 7.9 7.97 ];
z=[ 2.31 1.71 3.52 2.45 2.6 1.89 4.59 3.87 3.47 2.85 2.17 3.47 6.44 5.86 3.91 5.71 3 3.57 3.1 3.01 3.29 3.8 2.94 5.72 4.26 4.05 5.24 6.55 ];
[xmin, xmax] = bounds(x);
[ymin, ymax] = bounds(y);
X = linspace(xmin, xmax);
Y = linspace(ymin, ymax);
F = scatteredInterpolant(x(:), y(:), z(:));
[XG, YG] = ndgrid(X,Y);
ZG = F(XG, YG);
surf(XG, YG, ZG)
hold on
plot3(x, y, z, 'r*');
hold off
Categories
Find more on Surface and Mesh 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!


