Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- close all;
- clc;
- % Frequência de Amostragem
- fs = 10000;
- % Tempo de 10 segundos
- t = 0:1/fs:10;
- % Frequência normal
- fnormal = 60;
- % Definindo a frequência angular
- W = 2*pi*fnormal;
- % Definindo a amplitude
- A = 1;
- % Definindo a fase
- phi = pi/2;
- % Função x(t) original e as função deslocadas
- x = A*sin(W*t+phi);
- normal = length(x);
- aux = 0:normal-1;
- T = normal/fs;
- freq = aux/T;
- X = fftn(x)/normal;
- fc = ceil(normal/2);
- X = X(1:fc);
- figure();
- % Domínio do tempo
- subplot(2,1,1)
- hold on
- axis([0 0.2 -1 1])
- plot(t,x,'r');
- xlabel('Tempo','FontSize',12);
- ylabel('Amplitude','FontSize',12);
- % Domínio da frequência
- subplot(2,1,2)
- hold on
- axis([0 120 0 0.6])
- plot(freq(1:fc), abs(X));
- xlabel('Freq.(Hz)', 'FontSize', 12);
- ylabel('Amplitude', 'FontSize', 12);
- print -dpng FFT1.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement