How to find the sampling frequency?
Show older comments
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));
Accepted Answer
More Answers (0)
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



