3D Z number as the same as input value?
Show older comments
>>X= [1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5] <-enter
>>Y=[1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5] <-enter
>>z =[152 89 100 100 100
103 0 100 100 100
89 13 100 100 100
115 100 187 200 111
100 85 111 97 48] <-enter
>> [x,y]=meshgrid(1:.5:5,1:.5:5);
>> z=peaks(x,y);
>> surf(x,y,z)
Is there any other way to represent z number exactly whatever I input? because i just want to show 3d graph from non-continues points.
Accepted Answer
More Answers (1)
Walter Roberson
on 11 Jan 2013
scatter3(X(:), Y(:), z(:))
7 Comments
Debbie
on 12 Jan 2013
Debbie
on 12 Jan 2013
Walter Roberson
on 12 Jan 2013
Your x is 380 entries long, but your y and z are 361 entries long. That is 20*19 compared to 19*19
Debbie
on 12 Jan 2013
Walter Roberson
on 12 Jan 2013
MATLAB is case sensitive. Watch out for x compared to X .
Debbie
on 12 Jan 2013
Randy Souza
on 14 Jan 2013
For reference, this answer was previously listed as accepted due to a bug in MATLAB Answers. Debbie accepted Azzi's answer first, so I left it as the accepted answer. However, Walter does keep the reputation points earned for an accepted answer.
Categories
Find more on 2-D and 3-D 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!