mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sw-plotting-tool.git
synced 2025-06-10 01:55:59 +00:00
Added changeable X-Axis. Does not work for Fourier plot since the spectogram function does not support it.
Also added differentiation functions (not used yet).
This commit is contained in:
parent
715c2fa53c
commit
3a19f862ad
Binary file not shown.
63
diffPlotFnc.m
Normal file
63
diffPlotFnc.m
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
function diffPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path, order)
|
||||||
|
|
||||||
|
%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
|
||||||
|
if ending == 0
|
||||||
|
timeArray = data(:,1);
|
||||||
|
yData = data(:, 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
|
||||||
|
end
|
||||||
|
|
||||||
|
%Plot the channel
|
||||||
|
figure(channel)
|
||||||
|
plot(timeArray, yData, '-b');
|
||||||
|
hold all
|
||||||
|
plot(timeArray, diff(yData), '-r');
|
||||||
|
ylabel(yAxis{channel}.Value);
|
||||||
|
xlabel(xAxis{channel}.Value);
|
||||||
|
legend('Original', 'Derivative')
|
||||||
|
title(channels{channel});
|
||||||
|
|
||||||
|
%Save plot
|
||||||
|
saveFigs('median', figure(channel), channels(channel), path, fileSettings{1}.Value)
|
||||||
|
|
||||||
|
%reset
|
||||||
|
hold off
|
||||||
|
close all;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path)
|
function fourierPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path)
|
||||||
|
|
||||||
%Iterate through all channels
|
%Iterate through all channels
|
||||||
for channel = 1:width(data)
|
for channel = 1:width(data)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path)
|
function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path)
|
||||||
|
|
||||||
%Iterate through all channels
|
%Iterate through all channels
|
||||||
for channel = 1:width(data)
|
for channel = 1:width(data)
|
||||||
@ -46,7 +46,7 @@ function graphPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channe
|
|||||||
figure(channel)
|
figure(channel)
|
||||||
plot(timeArray, yData);
|
plot(timeArray, yData);
|
||||||
ylabel(yAxis{channel}.Value);
|
ylabel(yAxis{channel}.Value);
|
||||||
xlabel('Time [s]');
|
xlabel(xAxis{channel}.Value);
|
||||||
title(channels{channel});
|
title(channels{channel});
|
||||||
|
|
||||||
%Save plot
|
%Save plot
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channels, path, order)
|
function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, xAxis, channels, path, order)
|
||||||
|
|
||||||
%Iterate through all channels
|
%Iterate through all channels
|
||||||
for channel = 1:width(data)
|
for channel = 1:width(data)
|
||||||
@ -45,7 +45,7 @@ function meanPlotFnc(data, fileSettings, checkboxes, start, stop, yAxis, channel
|
|||||||
hold all
|
hold all
|
||||||
plot(timeArray, movmean(yData, str2double(order)), '-r');
|
plot(timeArray, movmean(yData, str2double(order)), '-r');
|
||||||
ylabel(yAxis{channel}.Value);
|
ylabel(yAxis{channel}.Value);
|
||||||
xlabel('Time [s]');
|
xlabel(xAxis{channel}.Value);
|
||||||
legend('Without movmean', strcat('With movmean (', order, 'th order)'))
|
legend('Without movmean', strcat('With movmean (', order, 'th order)'))
|
||||||
title(channels{channel});
|
title(channels{channel});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user