필터 지우기
필터 지우기

why this fourrier transform is not good?

조회 수: 1 (최근 30일)
Kobi
Kobi 2016년 7월 15일
댓글: Kobi 2016년 7월 16일
this script should calculate the fourier transform of a single sine with frequency of 1KHz and for some reason i can't see the pulses in the frequency domain at the -1000 and 1000, please help
clear all
close all
clc
% Downsampling
f_max=1e3;
fs=4e3;
t=linspace(0,1/f_max,fs);
y=sin(2*pi*f_max*t);
frequency_domain=linspace(-fs/2,fs/2,length(t));
figure;
col=4; row=2;
subplot(col,row,1)
plot(t,y)
title('\bf The Original signal')
ylabel('Amplitude')
xlabel('Time')
grid on
subplot(col,row,3)
stem(t,y)
title('\bf The sampled signal')
ylabel('Amplitude')
xlabel('Time')
grid on
% sampled signal in the frequency domain
subplot(col,row,4)
Y=fft(y)/length(y);
Y=fftshift(Y);
plot(frequency_domain,abs(Y))
title('\bf The Original signal in the frequency domain')
ylabel('Magnitude')
xlabel('frequency')
grid on
xlim([-2e3 2e3])

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 7월 16일
Kobi - why is your time domain initialized as
t=linspace(0,1/f_max,fs);
Aren't you interested in the full second since fs is the sampling frequency (number of samples per second)? Instead, try
t = linspace(0,1-1/f_max,fs);
and see what happens.
  댓글 수: 1
Kobi
Kobi 2016년 7월 16일
if i change the script as you said, i can't sample the signal properly, i get something like a sawtooth wave

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by