FIC MATLAB 2018-2/Aula-9
Ir para navegação
Ir para pesquisar
%% Script incrível
%
% Nesta script administrativa, iremos fazer algo incrível.
%% Cálculos realizados
%
% Aqui, iremos calcular w, que não servirá para mais nada.
x = 'Betão';
if strcmp(x,'Ramon!')
disp('É um')
elseif x == 2
disp('É dois')
elseif strcmp(x,'Betão')
disp('É três')
disp('Ramon')
else
disp('É quatro')
t = 0:0.1:10;
s = sin(t);
figure
comet(t,s)
title('Seno de t')
end
disp(['O valor de x é ' num2str(x)])
%% Seno de um valor importante
%
% O $\sin(\pi \Omega \omega^2)$ é uma função legal.
t = 0:0.1:10;
s = sin(t);
figure
comet(t,s)
title('Seno de t')
%%
n = input('Enter a number: ');
switch n
case 'teste'
disp('negative one')
case 0
disp('zero')
case 1
disp('positive one')
otherwise
disp('other value')
end
%%
x = [12 64 24];
plottype = 'pie';
switch plottype
case 'bar'
bar(x)
title('Bar Graph')
case {'pie','pie3'}
pie3(x)
title('Pie Chart')
otherwise
warning('Unexpected plot type. No plot created.')
end
</syntaxhighlight>