surf function give wrong graph
Afficher commentaires plus anciens
I am using surf to draw a surface when given 3 matrix, y_test, z_test, m_k.
y_test and z_test is both 1x100. m_k is a 100x100 matrix.
I have attach mat files of y_test, z_test, m_k.
I use this code:
surf(y_test,z_test,m_k)
And it give the graph like in the surf.png i attach.
This graph is wrong though, i try this point :
plot3(0.7990,8.8932,1.7064,'.r','markersize',10);
It is the red point you see in the graph. It is way off, not even close to the surface.
If i use loops to pot this point by point, like the code below:
count_i = 0;
count_j = 0;
for i = y_test
count_i = count_i + 1;
if count_j == 100
count_j = 0;
end
for j = z_test
count_j = count_j + 1;
m_k(count_i,count_j) = - m_k_ranhTQ_1(x,input,beta0,kbeta_bao_hoa,x_delta,kI,Ka,time,Z1,Z2,i,j);
plot3(y_test(count_i),z_test(count_j),m_k(count_i,count_j),'.r','markersize',1);
hold on;
end
end
It will give correct graph, like in the correct plot.png i attach. The redder point i use to check is on the "surface" of points.
Can someone explain this? Is the surf function some how alter the results to get a smooth surface or something?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Computational Geometry dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

