MATLAB Answers

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

8 views (last 30 days)
Cut Alna Fadhilla
Cut Alna Fadhilla on 15 Apr 2020
Edited: Prabhan Purwar on 21 Apr 2020
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

  0 Comments

Sign in to comment.

Answers (1)

Prabhan Purwar
Prabhan Purwar on 21 Apr 2020
Edited: Prabhan Purwar on 21 Apr 2020
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:

  0 Comments

Sign in to comment.

Tags


Translated by