make a plot of the first second of the raw data in matlab

Assuming the raw data is stored in a variable called raw_data, you can do the following:

main.m
Fs = 1000; % Sampling frequency in Hz
N = Fs; % Duration of plot in samples
t = (0:N-1)/Fs; % Time vector in seconds
figure;
plot(t, raw_data(1:N));
xlabel('Time (s)');
ylabel('Amplitude');
190 chars
8 lines

This code will make a plot of the first N = Fs samples (i.e. the first second) of the raw_data variable. The t variable is constructed to be a time vector in seconds that is the same length as the raw_data samples, and the plot function is used to plot the data against the time vector. The xlabel and ylabel functions are used to label the axes of the plot.

related categories

gistlibby LogSnag