|
@@ -5,13 +5,13 @@
|
|
|
%% sphear_capsule_plot_frequency_response: plot frequency response of capsule signals
|
|
%% sphear_capsule_plot_frequency_response: plot frequency response of capsule signals
|
|
|
%%
|
|
%%
|
|
|
%% usage:
|
|
%% usage:
|
|
|
-%% [] = sphear_capsule_plot_frequency_response(SIG, fmin, fmax, ymin, ymax, Nfft, plot_on, smooth)
|
|
|
|
|
|
|
+%% [] = sphear_capsule_plot_frequency_response(SIG, fmin, fmax, ymin, ymax, FS, fft_size, plot_on, smooth)
|
|
|
%%
|
|
%%
|
|
|
%% SIG: signals for each measurement
|
|
%% SIG: signals for each measurement
|
|
|
%% fmin, fmax: range of frequencies to use
|
|
%% fmin, fmax: range of frequencies to use
|
|
|
%% ymin, ymax: y range to plot
|
|
%% ymin, ymax: y range to plot
|
|
|
-%% Fs: sampling rate
|
|
|
|
|
-%% Nfft: size of fft used to calculate frequency response
|
|
|
|
|
|
|
+%% FS: sampling rate
|
|
|
|
|
+%% fft_size: size of fft used to calculate frequency response
|
|
|
%%
|
|
%%
|
|
|
%% optional parameters:
|
|
%% optional parameters:
|
|
|
%%
|
|
%%
|
|
@@ -35,9 +35,9 @@
|
|
|
%% You should have received a copy of the GNU General Public License
|
|
%% You should have received a copy of the GNU General Public License
|
|
|
%% along with this program. If not, see <htp://www.gnu.org/licenses/>.
|
|
%% along with this program. If not, see <htp://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
-function [] = sphear_capsule_plot_frequency_response(SIG, measurements, fmin, fmax, ymin, ymax, Fs, Nfft, smooth)
|
|
|
|
|
|
|
+function [] = sphear_capsule_plot_frequency_response(SIG, measurements, fmin, fmax, ymin, ymax, FS, fft_size, smooth)
|
|
|
|
|
|
|
|
- %% no smoothing or plotting by default
|
|
|
|
|
|
|
+ %% no smoothing by default
|
|
|
if (!exist("smooth"))
|
|
if (!exist("smooth"))
|
|
|
smooth = 0;
|
|
smooth = 0;
|
|
|
end
|
|
end
|
|
@@ -45,9 +45,9 @@ function [] = sphear_capsule_plot_frequency_response(SIG, measurements, fmin, fm
|
|
|
%% calculate frequency responses
|
|
%% calculate frequency responses
|
|
|
for m = measurements
|
|
for m = measurements
|
|
|
if (smooth > 0)
|
|
if (smooth > 0)
|
|
|
- sfft(m,c,:) = fastsmooth(20*log10(abs(fft(SIG(m,c,:), Nfft))), smooth, 2, 1);
|
|
|
|
|
|
|
+ sfft(m,c,:) = fastsmooth(20*log10(abs(fft(SIG(m,c,:), fft_size))), smooth, 2, 1);
|
|
|
else
|
|
else
|
|
|
- sfft(m,c,:) = 20*log10(abs(fft(SIG(m,c,:), Nfft)));
|
|
|
|
|
|
|
+ sfft(m,c,:) = 20*log10(abs(fft(SIG(m,c,:), fft_size)));
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
%% color plot
|
|
%% color plot
|
|
@@ -56,7 +56,7 @@ function [] = sphear_capsule_plot_frequency_response(SIG, measurements, fmin, fm
|
|
|
|
|
|
|
|
f = figure;
|
|
f = figure;
|
|
|
hold on;
|
|
hold on;
|
|
|
- fr = (1:Nfft/2) * Fs/Nfft;
|
|
|
|
|
|
|
+ fr = (1:fft_size/2) * FS/fft_size;
|
|
|
grid on;
|
|
grid on;
|
|
|
angle = 360 / 16 * (m - 1);
|
|
angle = 360 / 16 * (m - 1);
|
|
|
%% we add the title as a subfigure in the paper
|
|
%% we add the title as a subfigure in the paper
|