convert cartesian plot into frequency domain
Show older comments
How can I convert Cartesian plot into frequency domain?? Please, help!
Answers (1)
We can use the Fast Fourier Transform, “fft” function to convert a cartesian plot into the frequency domain. It takes as input a vector or matrix containing the time-domain data and provides an output of the same size in the frequency domain.
Here is an example code to convert time domain data to frequency domain.
t = 0:0.001:1; % Time vector
x = sin(2*pi*50*t); % Example signal
N = length(x);
Fs = 1/(t(2)-t(1)); % Sampling frequency
X = fft(x);
f = (0:N-1)*(Fs/N);
magnitude = abs(X)/N;
half_N = floor(N/2)+1;
figure;
plot(f(1:half_N), magnitude(1:half_N));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Domain Representation');
To convert a Cartesian plot to the frequency domain, apply the “fft” to the y-data (the signal values), not to the plot itself. The x-axis of the original plot is typically time or space, and the y-axis is the signal amplitude.
For more information on “fft”, refer to the below documentation link:
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!