How to find the sampling frequency?
이전 댓글 표시
Hello, I am trying to plot the frequency domain of a fourier transform of a piecewise signal. Can someone help me understand further the right sampling frequency as well as the frequency domain maximum/minimum value to evaluate the correct frequency domain? I appreciate your time.
% Sampling Time
ts = 1000;
% Time domain variables
t1=-2:1/ts:2;
t2=2:1/ts:4;
% Evaluation at those time domains
x1=4*ones(size(t1));
x2=-8*ones(size(t2));
% Combining both time domains of the piecewise functions
t=[t1 t2];
% Combining functions
f=[x1 x2];
% Plot the piecewise function with respect to time
figure(1);
plot(t,f);
ylim([-10 6]);
% Unsure of this part's sample and frequency domain
% I chose the sample based on the size of the combined time (t).
% Samples
N=6002;
% Frequency Domain (
freq=-ts/2:ts/(N-1):ts/2;
% Fourier transform of the piecewise function (f)
ft=fft(fftshift(f));
% Figure 2 shows the absolute of the fourier transform with respect to the
% frequency
figure(2);
plot(freq,abs(ft));
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




