mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sw-plotting-tool.git
synced 2025-06-10 01:55:59 +00:00
65 lines
1.9 KiB
Matlab
65 lines
1.9 KiB
Matlab
function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path)
|
|
|
|
%Iterate through all channels
|
|
for channel = 1:width(data)
|
|
|
|
%If Graph is checked
|
|
if checkboxes{channel}.Value == 1
|
|
|
|
%Convert start and ending time
|
|
beginning = str2double(start{channel}.Value);
|
|
ending = str2double(stop{channel}.Value);
|
|
|
|
%if first row increment is not checked
|
|
if fileSettings{2}.Value == 0
|
|
[timeArray, yData] = timeAxisWithIncrement(data, fileSettings{3}.Value, beginning, ending, channel);
|
|
else
|
|
timeIndex = 1;
|
|
while data(timeIndex,1) < str2double(start{channel}.Value)
|
|
timeIndex = timeIndex + 1;
|
|
end
|
|
|
|
startIndex = timeIndex;
|
|
|
|
while data(timeIndex, 1) <= str2double(stop{channel}.Value) || timeIndex >= length(data)
|
|
timeArray(timeIndex - startIndex + 1) = data(timeIndex,1);
|
|
timeIndex = timeIndex + 1;
|
|
end
|
|
|
|
endIndex = timeIndex;
|
|
|
|
for timeIndex = startIndex:endIndex - 1
|
|
yData(timeIndex - startIndex + 1) = data(timeIndex, channel);
|
|
end
|
|
end
|
|
|
|
fs = 1 / fileSettings{3}.Value;
|
|
|
|
if length(yData) < 1024
|
|
Nspec = length(yData) - 1;
|
|
else
|
|
Nspec = 1024;
|
|
end
|
|
wspec = hamming(Nspec);
|
|
Noverlap = Nspec/2;
|
|
|
|
hold on
|
|
figure(channel)
|
|
|
|
spectrogram(yData, wspec, Noverlap, Nspec, fs, 'yaxis');
|
|
title(channels{channel});
|
|
|
|
|
|
saveFigs('fourier', figure(channel), channels(channel), path, fileSettings{1}.Value)
|
|
|
|
%reset
|
|
hold off;
|
|
close all;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|