» x=[1 2 3 4 5 6];
» y=[1 4 9 2 3 8 ];
» xi=[0:0.1:10];
» yi=spline(x,y,xi);
» plot(xi,yi,x,y,'*')
Exemplo
>>y=[ 1 3 2 4 5 3 4 3 7 8 9 5 6 7 8 2 3 4 5 6 7 6 7 5 4 3 9 8 9 7 ];
>>hist(y)
Exemplo
>>x=-13000:520:13000;
>>y=x;
>>[X ,Y]=meshdom(x,y);
>> a=1;b=2;p=1000;
>>z=(-X.^2/a^2+Y.^2/b^2)/(2*p);
>>subplot(121),mesh(z)
>>title(‘ Parábolóide Hiperbólico’)
Exemplo para pirâmide:
>>h=10; b=4
>>x1=[-b,0,b];y1=[b,0,-b];z1=[0,h,0];
>>x2=[-b,0,b];y2=[-b,0,b]; z2=[0,h,0];
>> x3=[-b,b,b,-b,-b]; y3=[b,b,-b,-b,b];
>> z3=zeros(size(x3));
>>plot3(x1,y1,z1, x2,y2,z2, x3,y3,z3)
>>print -dps pyramid
Exemplo
>>x=1:5 ; y=1:5;
>> xi=1:0.1:5; yi=1:0.1:5;
>> [XI YI]=meshgrid(xi,yi);
>> P=x; % definir aqui a função f(x,y)
>> PI=griddata(x,y,P,XI,YI);
>> mesh(PI)
>>mesh(XI,YI,PI)
>>print -dps pytagrid.ps
>>surf(XI,YI,PI)
>>print -dps pytasurf
>>surfc(XI,YI,PI) %aparecerá o domínio
>>xlabel(‘x’) % nome para eixos
>>ylabel(‘y’)
>>zlabel(‘z’)
>>print -dps pytasurfc