Plot serial time data from excel file
Show older comments
Hello.
I am trying to plot data from excel file. Column 2 (amplitude) vs Column 1 (time). The time is in second
Each second the data is sample 200 time.
0.000 (second zero sample zero) => 0.199 (second zero to sample 199) to second 120.004 (120 second. sample 004).
I try writing a code, but I am not able to make it work.
Also, I am trying to plot the results where xlabel show that each second there are 200 samples.
I have try some codes.
% Define the sampling parameters
Fs = 200; % Sampling frequency in Hz
duration = 5.199; % Duration in seconds
t = 0:1/Fs:duration; % Time vector from 0 to 5.199 seconds
% Read data from Excel file
data = readtable('HUAM1709.041_v3.xlsx'); % Replace with your actual file name
amplitude = data.Var2; % Assuming the second column contains the amplitude data
% Ensure the time vector matches the length of the amplitude data
if length(amplitude) ~= length(t)
error('Length of amplitude data does not match the time vector.');
end
% Plot the discrete time series data
figure;
stem(t, amplitude, 'filled'); % Use stem for discrete data representation
xlabel('Time (seconds)');
ylabel('Amplitude');
title('Discrete Time Series Data from 0 to 5.199 seconds');
grid on;
This code was thanks to Star Strider (Level 10 Mathworks)
data = readtable('HUAM1709.041_v2.xlsx')
% return
T = data{:,1};
T = seconds(data{:,1});
T.Format = 'hh:mm';
T2 = data{:,2};
figure; % Place "figure" in this section allow to plot this data in a separate window.
plot (T,T2,'.');
title 'Accelerometer';
ylabel ('Amplitude');
xlabel ('Samples');
I am looking a plot like the attached file.
Where X axis is going from 0 to 120.
1 Comment
imshow(imread('NAA I Amplitude.jpg'))
.
Accepted Answer
More Answers (0)
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


