I got the code from my textbook and it is supposed to work in matlab(adsbygoogle = window.adsbygoogle || []).push({});

The code fails on fevalCode (Text):function r = midpoint(a,b,f,n)

f = fcnchk(f);

h = (b-a)/n;

x = (a+h*0.5):h:(b-h*0.5);

y = feval(f,x);

r = h*sum(y(1:n));

I go tcnchk from wikipedia

and I use f = 'x.^2' as fCode (Text):function f=fcnchk(x, n)

f = x;

end

Can someone help me?

I don't know how to copy the error from Octave

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Octave: Help with implementing midpoint rule

Loading...

Similar Threads - Octave Help implementing | Date |
---|---|

Matlab Octave integral computation help | Apr 20, 2017 |

I need help plotting some data using octave | Feb 9, 2013 |

Help with Octave for system of ODEs | Dec 10, 2012 |

Help with Octave | Jun 3, 2011 |

Help with Octave, installing package | Mar 31, 2009 |

**Physics Forums - The Fusion of Science and Community**