Generate plot of surface colored by the maximum error

Hello everyone,
I am currently working on a numerical algorithm for the approximation of 3D functions ( namely f(x,y,z) ). The algorithm works fine. Following is the final result/plot:
However, I do not want the plot to be displayed like that, I would like to plot it like this:
so that I can observe the maximum error and where it is located.
I already have the plot function that generates the second image, this is however a routine for 2D functions and I can't manage to write a 3D version of it. Following is the code:
function PlotSurf(xe,ye,Pf ,neval,exact,maxerr,fview)
figure
Pfplot = surf(xe,ye,reshape(Pf,neval,neval), reshape(abs(Pf-exact),neval,neval));
set(Pfplot,'FaceColor' ,'interp','EdgeColor','none');
[cmin cmax] = caxis;
caxis([cmin-.25*maxerr cmax]);
view(fview);
colormap hsv
vcb = colorbar('vert');
ylim(vcb, [0 maxerr])
set(get(vcb,'YLabel'),'String','Error')
xe and ye being the evaluation points,
Pf the values of the numerical algorithm,
neval the number of evaluation points,
exact the exact values of the function at the evaluation points xe and ye, it is necessary in order to calculate the maximum error
maxerr maximum error
Thank you in advance.

답변 (0개)

카테고리

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

질문:

2021년 10월 9일

편집:

2021년 10월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by