#include <math.h> #include <chplot.h> int main() { double x[20], y[30], z[600]; double levels[10]; int datasetnum =0, i, j; class CPlot plot; linspace(levels, -6, 6); linspace(x, -3, 3); linspace(y, -4, 4); for(i=0; i<20; i++) { for(j=0; j<30; j++) { z[30*i+j] = 3*(1-x[i])*(1-x[i])*exp(-(x[i]*x[i])-(y[j]+1)*(y[j]+1)) - 10*(x[i]/5 - x[i]*x[i]*x[i]-pow(y[j],5))*exp(-x[i]*x[i]-y[j]*y[j]) - 1/3*exp(-(x[i]+1)*(x[i]+1)-y[j]*y[j]); } } plot.data3D(x, y, z); plot.plotType(PLOT_PLOTTYPE_LINES, datasetnum); plot.contourLabel(PLOT_ON); plot.showMesh(PLOT_OFF); plot.contourMode(PLOT_CONTOUR_SURFACE); plot.contourLevels(levels); plot.plotting(); }