Friday, April 25, 2008

octave




Plotting a simple function with Octave


%first, we create a function with
function [y]=f(x)
y=sin(x);
end

%then we create an array with numbers; for a higher resolution we use 0.1-steps:
x=0:0.1:2*pi;

%feed the function:
[y]=f(x);

%plot it:
plot(x,y);grid;