Buscar

Exercício de sistemas lineares2

Prévia do material em texto

%01 - Esboce a forma de onda dos seguintes sinais. 
 
%(b) x(t) = u(t+1)-2u(t)+u(t-1) 
 
%Resposta: 
 
t = -5: 0.001: 5; % Define um vetor de tempo com 1001 pontos 
x = heaviside (t+1); % Descreve a função u(t+1) // -> heaviside 
função de DEGRAU UNITÁRIO. 
x1 = heaviside (t); % Descreve a função u(t) // -> heaviside 
função de DEGRAU UNITÁRIO. 
x2 = heaviside (t-1); % Descreve a função u(t-1) // -> heaviside 
função de DEGRAU UNITÁRIO. 
y = (x)-2*(x1)+(x2); % Efetua o cálculo da equação e armazena da 
variável Y. 
figure % Função que cria uma figura no MATLAB. 
 
subplot(411) % Cria subplot(Linhas, Colunas, n° de plots) 
plot(t,x,'LineWidth',2) % Plota u(t+1),em forma de linha, numero da 
largura da linha. 
plot(t,x, 'r', 'LineWidth',2) % Plota u(t+1), a letra 'r' define a cor da 
linha 'red'. 
grid on % Cria grade - 'linhas', no gráfico. 
legend ('u(t+1)') % Cria legendas na figura. 
axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). 
 
subplot(412) % Cria subplot(Linhas, Colunas, n° de plots) 
plot(t,2*x1,'LineWidth',2) % Plota 2u(t),em forma de linha, numero da 
largura da linha. 
plot(t,2*x1, 'k','LineWidth',2) % Plota 2u(t), a letra 'k' define a cor da linha 
'black'. 
grid on % Cria grade - 'linhas', no gráfico. 
legend ('2*u(t)') % Cria legendas na figura. 
axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). 
 
subplot(413) % Cria subplot(Linhas, Colunas, n° de plots) 
plot(t,x2,'LineWidth',2) % Plota u(t-1),em forma de linha, numero da 
largura da linha. 
plot(t,x2, 'y', 'LineWidth',2) % Plota u(t-1), a letra 'y' define a cor da 
linha 'yellow'. 
grid on % Cria grade - 'linhas', no gráfico. 
legend ('u(t-1)') % Cria legendas na figura. 
axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). 
 
subplot(414) % Cria subplot(Linhas, Colunas, n° de plots) 
plot(t,y, 'LineWidth',2) % Plota x(t),em forma de linha, numero da 
largura da linha. 
plot(t,y, 'b', 'LineWidth',2) % Plota x(t), a letra 'b' define a cor da linha 
'blue'. 
grid on % Cria grade - 'linhas', no gráfico. 
xlabel('tempo') % Cria uma faixa de escrita abaixo da figura. 
legend ('u(t+1)-2u(t)+u(t-1)',2) % Cria legendas na figura. 
axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]).

Outros materiais

Materiais relacionados

Perguntas relacionadas

Materiais recentes

Perguntas Recentes