Baixe o app para aproveitar ainda mais
Prévia do material em texto
%01 - Esboce a forma de onda dos seguintes sinais. %(e) x(t) = r(t+2)-r(t+1)-r(t-1)+r(t-2) %Resposta: t = -5: 0.001: 5; % Define um vetor de tempo com 1001 pontos x = heaviside (t+2); % Descreve a função r(t+2) // -> heaviside função de DEGRAU UNITÁRIO. x1 = heaviside (t+1); % Descreve a função r(t+1) // -> heaviside função de DEGRAU UNITÁRIO. x2 = heaviside (t-1); % Descreve a função r(t-2) // -> heaviside função de DEGRAU UNITÁRIO. x3 = heaviside (t-2); % Descreve a função r(t-2) // -> heaviside função de DEGRAU UNITÁRIO. y = (x)-(x1)-(x2)+(x3); % Efetua o cálculo da equação e armazena da variável Y. figure % Função que cria uma figura no MATLAB. subplot(511) % Cria subplot(Linhas, Colunas, n° de plots) plot(t,x,'LineWidth',2) % Plota r(t+2),em forma de linha, número da largura da linha. plot(t,x, 'r', 'LineWidth',2) % Plota r(t+2), a letra 'r' define a cor da linha 'red'. grid on % Cria grade - 'linhas', no gráfico. legend ('r(t+2)') % Cria legendas na figura. axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). subplot(512) % Cria subplot(Linhas, Colunas, n° de plots) plot(t,x1,'LineWidth',2) % Plota r(t+1),em forma de linha, número da largura da linha. plot(t,x1, 'k','LineWidth',2) % Plota r(t+1), a letra 'k' define a cor da linha 'black'. grid on % Cria grade - 'linhas', no gráfico. legend ('r(t+1)') % Cria legendas na figura. axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). subplot(513) % Cria subplot(Linhas, Colunas, n° de plots) plot(t,x2,'LineWidth',2) % Plota r(t-1),em forma de linha, número da largura da linha. plot(t,x2, 'y', 'LineWidth',2) % Plota r(t-1), a letra 'y' define a cor da linha 'yellow'. grid on % Cria grade - 'linhas', no gráfico. legend ('r(t-1)') % Cria legendas na figura. axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). subplot(514) % Cria subplot(Linhas, Colunas, n° de plots) plot(t,x3,'LineWidth',2) % Plota r(t-2),em forma de linha, número da largura da linha. plot(t,x3, 'g', 'LineWidth',2) % Plota r(t-2), a letra 'g' define a cor da linha 'green'. grid on % Cria grade - 'linhas', no gráfico. legend ('r(t-2)') % Cria legendas na figura. axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]). subplot(515) % Cria subplot(Linhas, Colunas, n° de plots) plot(t,y, 'LineWidth',2) % Plota x(t),em forma de linha, número 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 ('r(t+2)-r(t+1)-r(t-1)+r(t-2)',2) % Cria legendas na figura. axis ([-4 4 -4 4]) % Limita a figura ([Xmin Xmax Ymin Ymax]).
Compartilhar