Informatica 5 Liceo Scientifico Scienze Applicate/Grafici in Octave

Wikibooks, manuali e libri di testo liberi.
Jump to navigation Jump to search

Grafici con Octave[modifica]

% istogramma
x=0:15;
bar(x);
print -dpng "c:\\bar.png" 

Istogramma con octave

x=[3,5,10];
y=[23,44,52];
bar(x,y)
print -dpng "c:\\bar1.png" 
Octave Bar m
t=0:0.01:10*pi;
x=t.*sin(t);
y=t.*cos(t);
z=t;
plot3(x,y,z,'k','linewidth',1);
grid on;
xlabel('x');ylabel('y');zlabel('z');
print -dpng "c:\\plot3xyz.png" 
Plot tridimensionale xyz con Octave
x=-pi:0.1:pi;
y= -pi:0.1:pi;
[X,Y]=meshgrid(x,y);
Z= 2.^(-1.5*sqrt(X.^2+Y.^2.)).*sin(X).*sin(Y);
surf(X,Y,Z);
xlabel('x');ylabel('y');zlabel('z');
print -dpng "c:\\surfxyz_m.png" 
Surf tridimensionale xyz Octave
 tx = ty = linspace ( -8, 8, 41)';
[xx, yy] = meshgrid (tx, ty);
r = sqrt (xx .^ 2 + yy .^ 2) + eps;
tz = sin (r) ./ r;
mesh (tx, ty, tz);
print -dpng "c:\\meshxyz_m.png"


Plot Mesh xyz