- error -

댓글 수: 1

Ameer Hamza
Ameer Hamza 2020년 11월 28일
Dear all, I have the three vectors reported in the file "data.mat" (x,y,z respectively).
I need to 3D plot them. However, something strange happen, since the z vector is 0 all around the borders, but plotting it I obtained that z is 0 only in 4 points (along y=0 axis), as shown in the figure below:
I wrote this code, to do the plot above:
x = data(:,1);
y = data(:,2);
[X,Y] = meshgrid(x,y);
z = data(:,3)
Z = meshgrid(z);
sup = surf(X,Y,Z)
thanks in andvance for your help

댓글을 달려면 로그인하십시오.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 28일

0 개 추천

You first need to convert your data into a grid format using scattered interpolation
x = data(:,1);
y = data(:,2);
z = data(:,3);
mdl = scatteredInterpolant(x, y, z);
[xg, yg] = meshgrid(unique(x), unique(y));
zg = mdl(xg, yg);
sup = surf(xg,yg,zg)

댓글 수: 2

Francesco Porretta
Francesco Porretta 2020년 11월 28일
It works! thank you so much!
Ameer Hamza
Ameer Hamza 2020년 11월 28일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

2020년 11월 28일

댓글:

2020년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by