x = linspace(0,2*pi,30);
y = sin(x);
plot(x,y), title('Figure 25.1: Sine Wave')

waitforbuttonpress;

x = linspace(0,2*pi,30);
y = sin(x);
z = cos(x);
plot(x,y,x,z)
title('Figure 25.2: Sine and Cosine')

waitforbuttonpress;

x = linspace(0,2*pi,30);
y = sin(x);
z = cos(x);
W=[y;z];
plot(W,x) % plot x vs. the columns of W
title('Figure 25.3: Change Argument Order')

waitforbuttonpress;

y = linspace(1,10,30)+ logspace(1,2,30)*i;
plot(y)

waitforbuttonpress;

y = y - logspace(1,2,30)*i ;
plot(y)

waitforbuttonpress;

x = linspace(0,2*pi,30); 
y = sin(x); 
z = cos(x);
W=[y;z];
plot(W) % plot each column (2 elements) of W
title('Uma rede!')

waitforbuttonpress;

plot(x,y,'b*',x,y,'m-')

waitforbuttonpress;

grid on

waitforbuttonpress;

grid

waitforbuttonpress;

box off

waitforbuttonpress;

xlabel('nomeX')

waitforbuttonpress;

ylabel('nomeY')

waitforbuttonpress;

title('Figura XYZ')

waitforbuttonpress;

text(3,0.4,'seno(x)')

waitforbuttonpress;

gtext('seno(x)')

waitforbuttonpress;

title('Fixa limites para eixos')
axis([0 2*pi -1.5 2])

waitforbuttonpress

axis off

waitforbuttonpress

axis auto on

waitforbuttonpress

axis tight

waitforbuttonpress

hold on 
plot(W) % plot each column (2 elements) of W

waitforbuttonpress

%%mm2508.m
x = linspace(0,2*pi,30);
y = sin(x);
z = cos(x);
plot(x,y)
hold on
ishold  % return 1 (True) if hold is ON
plot(x,z,'m')
hold off 
ishold  % hold is no longer ON
title 'Figure 25.8: Use of hold command'

waitforbuttonpress

figure

waitforbuttonpress

figure(1)

waitforbuttonpress

figure(2)

waitforbuttonpress

close(2)

waitforbuttonpress

clf

waitforbuttonpress

%%mm2509.m
x = linspace(0,2*pi,30);
y = sin(x);
z = cos(x);
a = 2*sin(x).*cos(x);
b = sin(x)./(cos(x)+eps); 
subplot(2,2,1) % pick the upper left of a 2-by-2 grid of subplots
plot(x,y), axis([0 2*pi -1 1]), title('Figure 25.09a: sin(x)') 

waitforbuttonpress

subplot(2,2,2) % pick the upper right of the 4 subplots
plot(x,z), axis([0 2*pi -1 1]), title('Figure 25.09b: cos(x)') 

waitforbuttonpress

subplot(2,2,3) % pick the lower left of the 4 subplots
plot(x,a), axis([0 2*pi -1 1]), title('Figure 25.09c: 2sin(x)cos(x)') 
subplot(2,2,4) % pick the lower right of the 4 subplots
plot(x,b), axis([0 2*pi -20 20]), title('Figure 25.09d: sin(x)/cos(x)') 

waitforbuttonpress

%%mm2510.m
x = linspace(0,2*pi,30);
y = sin(x);
z = cos(x);
plot(x,y,x,z)
legend('sin(x)','cos(x)')
title('Figure 25.10: Legend Example')

waitforbuttonpress

ginput(3)

%%uso de semilogs
clf
x=linspace(0,20)
y=2.^x
semilogy(x,y)

waitforbuttonpress

%%uso simples de área
x=linspace(0,10);
y=x.^2;
area(x,y)
title('area sob x^2')

waitforbuttonpress

%%mm2511.m
z = -pi:pi/5:pi;
area([sin(z);cos(z)])
title('Figure 25.11: Stacked Area Plot')

waitforbuttonpress

%%mm2512.m
t = (1:2:15)'*pi/8;
x = sin(t);
y = cos(t);
fill(x,y,'r') % a filled red circle using only 8 data points
axis square off
text(0,0,'STOP', ...
   'Color',[1 1 1], ...
   'FontSize',80, ...
   'FontWeight','bold', ...
   'HorizontalAlignment','center')
title('Figure 25.12: Stop Sign')

waitforbuttonpress

%%mm2513.m
a = [.5 1 1.6 1.2 .8 2.1];
pie(a,a==max(a)); % chart a and pull out the biggest slice
title('Figure 25.13: Example Pie Chart')

waitforbuttonpress

%%mm2514.m
x = -2*pi:pi/10:2*pi;
y = sin(x);
z = 3*cos(x);
subplot(2,1,1), plot(x,y,x,z)
title('Figure 25.14a: Two plots on the same scale.');
subplot(2,1,2), plotyy(x,y,x,z)
title('Figure 25.14b: Two plots on different scales.');

waitforbuttonpress

%%mm2515.m
x = -2.9:0.2:2.9;
y = exp(-x.*x);
subplot(2,2,1)
bar(x,y)
title('Figure 25.15a: 2-D Bar Chart')
subplot(2,2,2)
bar3(x,y,'r')
title('Figure 25.15b: 3-D Bar Chart')
subplot(2,2,3)
stairs(x,y)
title('Figure 25.15c: Stair Chart')
subplot(2,2,4)
barh(x,y)
title('Figure 25.15d: Horizontal Bar Chart')

waitforbuttonpress

%%mm2516.m
x = -2.9:0.2:2.9; % specify the bins to use
y = randn(5000,1); % generate 5000 random data points
hist(y,x) % draw the histogram
title('Figure 25.16: Histogram of Gaussian Data')

waitforbuttonpress

%%mm2517.m
z = randn(30,1); % create some random data
stem(z,'--') % draw a stem plot using dashed linestyle
set(gca,'YGrid','on')
title('Figure 25.17: Stem Plot of Random Data')

waitforbuttonpress

%%variação do mm2517.m
figure % nova janela
x = logspace(0,2,30);  stem(x,z)
set(gca,'YGrid','on')
close

waitforbuttonpress

%%mm2518.m
x = linspace(0,2,21); % create a vector
y = erf(x); % y is the error function of x
e = rand(size(x))/10; % e contains random error values
errorbar(x,y,e) % create the plot
title('Figure 25.18: Errorbar Plot')

waitforbuttonpress

%%mm2520.m
x=rand(40,1);
y=randn(40,1);
area=20+(1:40);
scatter(x,y,area)
box on
title('Figure 25.20: A scatter plot')

waitforbuttonpress

%%mm2519.m
t = linspace(0,2*pi);
r = sin(2*t).*cos(2*t);
subplot(2,2,1)
polar(t,r), title('Figure 25.19a: Polar Plot')

waitforbuttonpress

subplot(2,2,4)
v = randn(1000,1)*pi;
rose(v)
title('Figure 25.19d: Angle Histogram')

waitforbuttonpress

z = eig(randn(20));
subplot(2,2,2)
compass(z)
title('Figure 25.19b: Compass Plot')

waitforbuttonpress

subplot(2,2,3)
feather(z)
title('Figure 25.19c: Feather Plot')

waitforbuttonpress

%%mm2521.m
fplot(@humps,[-.5 3])
title('Figure 25.21: Fplot of the Humps Function')
xlabel('x')
ylabel('humps(x)')

waitforbuttonpress

%%mm2522.m
fstr='sin(x)/(x)';
ezplot(fstr,[-15,15])
title(['Figure 25.22: ' fstr])

waitforbuttonpress

%%mm2523.m
istr='(x-2)^2/(2^2) + (y+1)^2/(3^2) - 1';
ezplot(istr,[-2 6 -5 3])
axis square
grid
title(['Figure 25.23: ' istr])
close

waitforbuttonpress

%%mm2524.m
axes;
axis([0 1 0 0.5])
text(0.2,0.1,'\itE = M\cdotC^{\rm2}')
text(0.2,0.2,'\fontsize{16} \nabla \times H = J + \partialD/\partialt')
text(0.2,0.3,'\fontname{courier} \fontsize{16} \bf x_{\alpha} + y^{2\pi}')
fsstr='f(t) = A_o + \fontsize{30}_\Sigma\fontsize{10}';
text(0.2,0.4,[fsstr '[A_ncos(n\omega_ot) + B_nsin(n\omega_ot)]'])
title('Figure 25.24: Tex Formatting Examples')
