Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
619 B
2
Indexable
Never
clc
clear all
close all
disp('Processando');

%--------
%Sinal 
fs = 1000;
t = -2*pi:1/fs:2*pi;
t1 = linspace(-2*pi, 2*pi, fs);
x = 0.5* sin(2*pi*100*t) + 0.1*sin(2*pi*250*t);
x1 = 0.5*sin(2*pi*100*t1) + 0.1*sin(2*pi*250*t1);
%-----------
%FFT
N = length(x);
T = N/fs; %período
freq = linspace(0, N, N)/T;
fc= ceil(N/2); %para ajustar os dados do vetor
X = fft(x)/N;
X = X(1:fc);
%-----------

figure
plot(t1,x1);
%comet(t,y)
title('Sinal de Entrada');
%-----
figure 
plot(freq(1:fc), abs(X));
ylabel('|X|');
xlabel('freq (Hz)');
title('Analise do sinal');
grid on 
%----
disp('FIM');