How to compare between two surface plots in matlab?
Mostrar comentarios más antiguos
A and B are two 2D matrices with dimensions (length(X), length(Y)) which are function of X and Y vectors. I plot A and B in a 3D graph using surf as follows:
figure(1)
surf(X,Y,A)
hold on
surf(X,Y,B)
hold on
But, the generated figure doesn't show the difference in values between A and B clearly.
Is there any other way where I can compare between A and B in a 3D plot and show the differences between them clearly?
Respuesta aceptada
Más respuestas (1)
Ameer Hamza
el 12 de Nov. de 2020
Sometime plotting the difference can be helpful for visualization
figure(1)
surf(X,Y,A-B)
7 comentarios
Adi Nor
el 12 de Nov. de 2020
Ameer Hamza
el 12 de Nov. de 2020
Ok. In that case, I think plotting the estimated values as surface, and the original data points as scattered points will be helpful. For example
figure(1)
surf(X,Y,A)
hold on
scatter3(X(:),Y(:),B(:), 'r+')
hold on
Adi Nor
el 12 de Nov. de 2020
Ameer Hamza
el 12 de Nov. de 2020
Ok, If X and Y are vectors then modify the code to this
figure(1)
surf(X,Y,A)
hold on
[Xg, Yg] = meshgrid(X, Y);
scatter3(Xg(:),Yg(:),B(:), 'r+')
hold on
Adi Nor
el 12 de Nov. de 2020
Ameer Hamza
el 12 de Nov. de 2020
Try the code in my last comment.
Adi Nor
el 12 de Nov. de 2020
Categorías
Más información sobre Contour Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
