I have a table/array/matrix of values in the MATLAB workspace, representing data from sensors, each arranged in a column. The columns have different sample times, depending on the sensor, and I want to separate these columns so that I can have workspace variables that correspond to each sample rate. I also want to add that sampling rate so that the data points correspond to a specific time of measurement. How do I do this?
This is achievable in MATLAB with some commands to clean up our data first and then create a Timeseries Object. Assuming you have an array of real numbers of size 300x6 meaning you have 6 sensors and 300 data points for each for example:
>> data = [rand(100,2) ; zeros(200,2)] >> data = [data, rand(300,4)];
first you can select the columns with a specific sample rate, for example the first 2:
>> dataAtSampleRate1 = data(:,1:2);
then we can clean it up by noticing that many of the values of these columns are zero, meaning it was padded with non-existent data, so we can remove them. First we find the first row where the padding starts:
>> [index, ~] = find(~dataAtSampleRate1,1)
then we remove the data starting at that row:
>> dataAtSampleRate1(index:end,:) = [];
Now we need to create a Timeseries Object to specify a sample time for the data and assign times to each row:
>> ts = timeseries(dataAtSampleRate1)
Now we can double-click on the "ts" variable in the Workspace window, select "Uniform time vector" and add start and end times for the data collection. This will automatically calculate the measurement time for all the data points in "ts".
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.