Problem description
We are supposed to make this program work but we don’t know why it won’t work.
Here’s the program:
function [tab_prim,I,average] = prog8(f,a,b,n)
w = (b-a)/n;
tab_x = a+w/2 : w : b-w/2;
tab_y = f(tab_x);
plot(tab_x,tab_y,’.’);
tab_prim = w * cumsum(tab_y);
I = tab_prim(end);
average = I/(b-a);
plot(tab_x,tab_prim,’+’,[a,b],[average,average]);
endfunction
The programm is supposed to make a graph.
My system
- OS: e.g. Windows 10 (version 2004) or Ubuntu 20.04
- Octave version: e.g. Version 6.1.0
- Installation method: e.g. Downloaded and installed “octave-6.1.0-w64-installer.exe” from Download