# This script exercises an error that occurs when: # - using a helper function (_sumh) to compute an iterative summation of a term # - to produce a graph with ezmesh # # The output, including the error message is shown in the comment below #----------------- output ------------------ # ans = -1.0733 # ans = -18.272 # ans = 1.4576e-12 # ans = 1.3531 # error: _sumh: operator +: nonconformant arguments (op1 is 60x60, op2 is 1x9) # error: evaluating argument list element number 1 # error: called from: # error: _sumh at line 30, column 5 # error: evaluating argument list element number 1 # error: C at line 26, column 5 # error: /usr/share/octave/3.6.4/m/plot/private/__ezplot__.m at line 402, column 11 # error: /usr/share/octave/3.6.4/m/plot/ezmesh.m at line 73, column 19 # error: /home/erik/Develop/dispoctave/test/_sumh/exercise.m at line 49, column 1 #-------------- end of output --------------- clear all; function rv = C(x,t) rv = 2.*x.*sum(_sumh(x,t, -4:4)); endfunction function rv = _sumh(x,t, it) rv = exp(-(x.+(it.-1./2)).^2./t); endfunction # # Show that the functions work with a single invocation. # (at the corners of the (x,t) domain, used by the graph below) # C(-5,1) C(-5,10) C(10,1) C(10,10) # # Create a graph, using ezmesh # domain = [-5, 10, 1, 10]; graphics_toolkit gnuplot setenv GNUTERM wxt fh = @(x,t) C(x,t); ezmesh (fh, domain); # EOF