Get the data points after smoothening the plot

1 view (last 30 days)
I have 2 columns and 2388 rows.
I have plotted a graph with input column as y-axis and time as x-axis.
plot(table{3:2388,1}, {3:2388,2});
Then I smoothened the plot and obtained a graph as shown below.
smooth_curve = smoothdata(table{3:2388,2});
plot(table{3:2388,1}, smooth_curve);
How can I get the input(table{3:2388,2}) datapoints after smoothening the graph.

Accepted Answer

Star Strider
Star Strider on 12 Aug 2022
I am not certain what you are asking.
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1096630/Untitled%20spreadsheet.xlsx')
T1 = 2388×2 table
TIME INPUT ______ ________ 203.24 -9e-05 203.26 -9e-05 203.28 -9e-05 203.3 -9e-05 203.33 -9e-05 203.35 -9e-05 203.37 -9e-05 203.39 -0.00024 203.41 -9e-05 203.44 -0.00024 203.46 -0.00024 203.48 -0.00024 203.5 -0.00024 203.53 -0.00024 203.55 -0.00024 203.57 -0.00045
% smooth_curve = smoothdata(T1{3:2388,2});
smooth_curve = smoothdata(T1.INPUT);
T1 = addvars(T1,smooth_curve) % Add 'smooth_curve' To 'T1'
T1 = 2388×3 table
TIME INPUT smooth_curve ______ ________ ____________ 203.24 -9e-05 -0.0021584 203.26 -9e-05 -0.00219 203.28 -9e-05 -0.002221 203.3 -9e-05 -0.0022515 203.33 -9e-05 -0.0022862 203.35 -9e-05 -0.0023203 203.37 -9e-05 -0.0023538 203.39 -0.00024 -0.0023866 203.41 -9e-05 -0.0024189 203.44 -0.00024 -0.0024461 203.46 -0.00024 -0.0024773 203.48 -0.00024 -0.002508 203.5 -0.00024 -0.0025382 203.53 -0.00024 -0.0025679 203.55 -0.00024 -0.0025971 203.57 -0.00045 -0.0026258
VN = T1.Properties.VariableNames;
figure
plot(T1.TIME, T1.INPUT, 'DisplayName',VN{2})
hold on
plot(T1.TIME, T1.smooth_curve, 'DisplayName',strrep(VN{3},'_','\_')) % 'Escape' The Underline So It Prints Correctly In Tne 'legend'
hold off
legend('Location','best')
.

More Answers (0)

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!