# Sample 2-d plot (derivative) # You can run this by typing at the prompt: octave -q d2dplot.m outfile = "d2dplot.dat"; # Note that octave will by default name the matrix "filename", # but since variable names cannot start with a number it'll # call this one "X2dplot" instead of "2dplot". We then take # the numerical derivative and save. load 2dplot.dat z = X2dplot(:,1); dz = diff(z); points = [z(1:numel(z)-1) + dz(1)/2, diff(X2dplot(:,2))./dz]; fd = fopen(outfile, "wt"); fprintf(fd, "%14.6f %14.6f\n", \ reshape(points', 1, numel(points))); fclose(fd); disp("Done!");