Can i surface plot three vectors and fit a curve to get an equation of that surface?
2 views (last 30 days)
Show older comments
The following code gives me a 3D line plots as shown, i want to fit a 3D surface but whenever i am trying to use commands like patch, meshgrid, surf - Matlab gives an error saying "z must be a matrix and not a vector".
In other words, i intend to do 2 things,
- Surface plot the following data
- Fit an equation to get a values for intermediate values, similar to interpolation
Even if you could guide me on one of the above, please consider answering this.
I have attached the code and image of plot below
x =[400;500;600;700;800;900;1000];
y1 = [60;60;60;60;60;60;60];
z1 = [3.2;4.1;5;5.8;6.6;7.5;8.16];
plot3(x,y1,z1);
hold on
y2 = [100;100;100;100;100;100;100];
z2 = [2.7;3.46;4.15;4.8;5.55;6.2;6.9];
plot3(x,y2,z2);
y3 = [125;125;125;125;125;125;125];
z3 = [2.5;3.17;3.81;4.4;5.1;5.7;6.2];
plot3(x,y3,z3);
y4 = [150;150;150;150;150;150;150];
z4 = [2.2;2.8;3.4;4.0;4.6;5.1;5.6];
plot3(x,y4,z4);
xlabel('x');
ylabel('y');
zlabel('z');
grid on
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/347655/image.png)
0 Comments
Answers (0)
See Also
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!