// Demonstrates the usage of the fplotxyz() function.
// Print out a sine wave with appropriate labels and grid range.
#include <math.h>
#include <chplot.h>

int main() {
    string_t title="fplotxyz()",                    // Define labels.
             xlabel="X-axis",
             ylabel="Y-axis",
             zlabel="Z-axis";
    double x0 = -3, xf = 3, y0 = -4, yf = 4;
    int x_num = 20, y_num = 50;

    double func(double x, double y) {               // function to be plotted

        return 3*(1-x)*(1-x)*exp(-(x*x) - (y+1)*(y+1) )
               - 10*(x/5 - x*x*x - pow(y,5))*exp(-x*x-y*y)
               - 1/3*exp(-(x+1)*(x+1) - y*y);
    }
    fplotxyz(func, x0, xf, y0, yf, x_num, y_num, title, xlabel, ylabel, zlabel);
}