How I plot 3d graph of known x,y,z ?

1 次查看(过去 30 天)
I have known x,y,z and I want to plot them in 3d graph, please how can I do that? The data is attached for your reference ..
Thanks in advance,
x = [1 5 10 50 100];
y = [0.001 0.125 0.25 0.5 1 5 10 50 100];
Number of Y
z= [0.7395 0.8675 0.8899 0.9069 0.9316 0.9777 0.9879 0.9904
Number 0.7652 0.8904 0.9062 0.9316 0.9516 0.9849 0.9924 0.9947
of 0.7739 0.8949 0.9157 0.94 0.9591 0.9874 0.9931 0.996
X 0.7805 0.9115 0.9369 0.9558 0.9705 0.9908 0.9958 0.997
0.7833 0.921 0.9429 0.9616 0.9738 0.9921 0.9965 0.9971]
i've tried this link, but there is an error
>> surf(X,Y,z)
Error using surf (line 71)
Data dimensions must agree.
Thank you

回答(1 个)

Prabhan Purwar
Prabhan Purwar 2020-4-21
编辑:Prabhan Purwar 2020-4-21
Hi,
Kindly refer to the following code:
x=[1 5 10 50 100];
y=[0.001 0.125 0.25 0.5 15 10 50 100];
Z=[0.7395 0.8675 0.8899 0.9069 0.9316 0.9777 0.9879 0.9904;
0.7652 0.8904 0.9062 0.9316 0.9516 0.9849 0.9924 0.9947;
0.7739 0.8949 0.9157 0.94 0.9591 0.9874 0.9931 0.996;
0.7805 0.9115 0.9369 0.9558 0.9705 0.9908 0.9958 0.997;
0.7833 0.921 0.9429 0.9616 0.9738 0.9921 0.9965 0.9971];
[X,Y] = meshgrid(y,x);
surf(X,Y,Z)
Note:
% If Z is 5 X 8;
% X should be 5 X 8; // created using meshgrid
% Y should be 5 X 8;
% and x is 1 X 5;
% and y is 1 X 8;
Output:
Following links may help:

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by