Clear Filters
Clear Filters

Display image with 3 variable from abundance of excel data.

2 views (last 30 days)
Dear community,
My data as attached is in every minute in every day of January 2014 from 31 different of observer (PRN). My variables I want to tackle are Day, Time and VTEC.
First, I need to find rate of change of the VTEC (ROV) within intervals of 1 minute for two cases (i) all PRN, (ii) individual PRN.
Then, I need to find the index for ROV (ROVI) by the standard deviation of the ROV in a five-minute interval also for both cases (i) all PRN, (ii) individual PRN.
Finally, I want to display the image of Time (x), Day (y) and ROVI and yes for both cases (i) all PRN, (ii) individual PRN.
If you asked me whether I already tried or not. The answer is yes (may refer my questions' asked) but I made in seperate code means calculate ROV one .m, ROVI another .m and I find it inconvenience for me. Furthermore, I encounter problem to do the image because of the ROVI value some is NaN and even in imaginary number. Hence, I also worry that what I've done from the start is completely wrong to what should be calculated.
I would be greatful if anyone could help settling this lingering problem.
  5 Comments
Cris LaPierre
Cris LaPierre on 9 Jan 2021
Edited: Cris LaPierre on 9 Jan 2021
You are getting complex numbers because you are taking the square root of negative numbers (some of your differences are negative). You can use either real or abs to extract the real part or compute the magnitude of your complex numbers (respectively).

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 9 Jan 2021
Edited: Cris LaPierre on 10 Jan 2021
I'm not familiar with the processing steps for this type of data, but here's a modified version of your code that creates the image. Remember, an image is a matrix. Your code is creating a vector.
There were some other mistakes in your code as well as unnecessary code. I've made changes (including removing the diff so sqrt is not complex) to create something that works. No claims to it being correct.
%___Read data___%
data = readtable("Book_A.xlsx");
%___Convert DAY and TIME into durations___%
data.DAY = days(data.DAY);
data.TIME = days(data.TIME);
%___Create a datetime___%
data.TimeStamp = datetime(2014,01,01) + data.DAY-1 + data.TIME;
data.TimeStamp.Format = "MM-dd-yy HH:mm";
%___Convert the table to a timetable___%
dataTT = table2timetable(data,"RowTimes","TimeStamp");
%___Use retime to average the PRN data into 1 or 5 minute increments___%
PRNTT1min = retime(dataTT(:,"VTEC"),"minutely","mean");
PRNTT5min = retime(dataTT(:,"VTEC"),"regular","mean","TimeStep",minutes(5));
%___Calculate ROV 5 minute in second or minute___%
ROV_5min = PRNTT5min.VTEC/5;
ROVI_Jan = sqrt( ROV_5min );
ROVI_Jan(isnan(ROVI_Jan))=0;
ROVI_all = reshape(ROVI_Jan,24*60/5,[])';
%___Display image___%
imagesc(ROVI_all);
caxis([0.0 1.0]);
colorbar;
colormap(jet)
%___Axes properities___%
set(gca,'FontSize',10);
xlabel('Coordinated Universal Time, UTC (hr)');
set(gca,'xTick',0:24:288);
set(gca,'xTickLabel',{ '0', '2', '4', '6', '8', '10', '12', '14', '16', '18', '20', '22','24'});
ylabel('Day of Month (DOM)');
set(gca,'yDir','normal')
set(gca,'yTick',0:5:31);
title({'Rate of change of VTEC index', '1 to 31 January 2014'},'FontSize',15);
  1 Comment
Ann
Ann on 10 Jan 2021
Edited: Ann on 10 Jan 2021
OH GOSH!!! Yours is perfectly perfect! I literaly crying after run the code.
I just noticed by removing the diff then divide with 5 minutes already answering the rate of change. I think I am completely clueless that time yea why should I do some diff to get the rate of change.
I am forever indebted to you, thank you so much, Cris!

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!