Determine the direction of travelling waves in Fourier Analysis
% I am conducting a FFT analysis and i I observed that there is travelling
% wave. Please, how do I determine the direction of the travelling waves?
% Compute the phase of the FFT: theta_phase = angle(Ytheta);
% Compute the mean phase difference: p = polyfit(f, theta_phase, 1);
% slope = p(1); % The slope of the phase vs. frequency plot
% Store the mean phase difference: mean_phase_diff(i) = slope;
% Then I test the mean_phase_diff(i) > 0 implies rightward direction or if
% mean_phase_diff(i) < 0 leftward direction. I am wondering if there is a
% better way or function to do this.
clear
%close all
pars.W = 20e-6;
pars.D = 2e-6;
% time discretisation – start, step and end
t = 0:0.025:5;
% Extract theta data
loaded_data = load(‘thetam.mat’);
thetam = loaded_data.thetam;
% Sample frequency
Fs = 1/(t(2) – t(1));
% Number of samples
L = length(t);
% Number of ramp slopes
num_ramp_slopes = size(thetam, 1);
% Frequency vector for FFT
f = (-L/2 : L/2-1) * (Fs / L);
% Loop through each ramp_slope
for i = 1:num_ramp_slopes
% Extract the theta data for the current ramp_slope
theta_data = thetam(i, :);
% Compute the FFT of the theta data
Ytheta = fft(theta_data);
% Shift zero frequency component to center
Ytheta = fftshift(Ytheta);
end
% Plot the magnitude of the FFT for the first ramp_slope
fig1 = figure;
plot(f, abs(fftshift(fft(thetam(1, :)))), ‘LineWidth’, 0.8);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude’);
title(‘FFT Magnitude for Ramp Slope 1’);
xlim([-Fs/2 Fs/2]);
grid on;% I am conducting a FFT analysis and i I observed that there is travelling
% wave. Please, how do I determine the direction of the travelling waves?
% Compute the phase of the FFT: theta_phase = angle(Ytheta);
% Compute the mean phase difference: p = polyfit(f, theta_phase, 1);
% slope = p(1); % The slope of the phase vs. frequency plot
% Store the mean phase difference: mean_phase_diff(i) = slope;
% Then I test the mean_phase_diff(i) > 0 implies rightward direction or if
% mean_phase_diff(i) < 0 leftward direction. I am wondering if there is a
% better way or function to do this.
clear
%close all
pars.W = 20e-6;
pars.D = 2e-6;
% time discretisation – start, step and end
t = 0:0.025:5;
% Extract theta data
loaded_data = load(‘thetam.mat’);
thetam = loaded_data.thetam;
% Sample frequency
Fs = 1/(t(2) – t(1));
% Number of samples
L = length(t);
% Number of ramp slopes
num_ramp_slopes = size(thetam, 1);
% Frequency vector for FFT
f = (-L/2 : L/2-1) * (Fs / L);
% Loop through each ramp_slope
for i = 1:num_ramp_slopes
% Extract the theta data for the current ramp_slope
theta_data = thetam(i, :);
% Compute the FFT of the theta data
Ytheta = fft(theta_data);
% Shift zero frequency component to center
Ytheta = fftshift(Ytheta);
end
% Plot the magnitude of the FFT for the first ramp_slope
fig1 = figure;
plot(f, abs(fftshift(fft(thetam(1, :)))), ‘LineWidth’, 0.8);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude’);
title(‘FFT Magnitude for Ramp Slope 1’);
xlim([-Fs/2 Fs/2]);
grid on; % I am conducting a FFT analysis and i I observed that there is travelling
% wave. Please, how do I determine the direction of the travelling waves?
% Compute the phase of the FFT: theta_phase = angle(Ytheta);
% Compute the mean phase difference: p = polyfit(f, theta_phase, 1);
% slope = p(1); % The slope of the phase vs. frequency plot
% Store the mean phase difference: mean_phase_diff(i) = slope;
% Then I test the mean_phase_diff(i) > 0 implies rightward direction or if
% mean_phase_diff(i) < 0 leftward direction. I am wondering if there is a
% better way or function to do this.
clear
%close all
pars.W = 20e-6;
pars.D = 2e-6;
% time discretisation – start, step and end
t = 0:0.025:5;
% Extract theta data
loaded_data = load(‘thetam.mat’);
thetam = loaded_data.thetam;
% Sample frequency
Fs = 1/(t(2) – t(1));
% Number of samples
L = length(t);
% Number of ramp slopes
num_ramp_slopes = size(thetam, 1);
% Frequency vector for FFT
f = (-L/2 : L/2-1) * (Fs / L);
% Loop through each ramp_slope
for i = 1:num_ramp_slopes
% Extract the theta data for the current ramp_slope
theta_data = thetam(i, :);
% Compute the FFT of the theta data
Ytheta = fft(theta_data);
% Shift zero frequency component to center
Ytheta = fftshift(Ytheta);
end
% Plot the magnitude of the FFT for the first ramp_slope
fig1 = figure;
plot(f, abs(fftshift(fft(thetam(1, :)))), ‘LineWidth’, 0.8);
xlabel(‘Frequency (Hz)’);
ylabel(‘Magnitude’);
title(‘FFT Magnitude for Ramp Slope 1’);
xlim([-Fs/2 Fs/2]);
grid on; wave direction, fourier series, fft MATLAB Answers — New Questions