Area in (mm) between the two graphs (integrale)

1 view (last 30 days)
Hello, I'm new at matlab so I'm a bit lost. But need this for my master thesis.
I'm working on green roofs, and in order to find out how much of the rain the roof can store, I need to finde the area (mm) - the integrale - as the difference between the two graphs. This is the area going from the starttime to the endtime, marked with orange on the picture. And I get the data in mm/min, (Q=mm/min). I was trying to do it like this:
%% Start and end time for the area starttime=datenum('21-09-2014 03:52:50','dd-mm-yyyy HH:MM'); endtime=datenum('21-09-2014 04:40:44','dd-mm-yyyy HH:MM');
%% Load DMI rain gauge data gaugeDataFolder='SVKdata';
[svkEventSummary,svkIntSummary,svkIntTs]=LoadSvk(gaugeDataFolder);
svkIntTs(1,:)=[]; % Deleting the first row
svkIntTs(:,1)=svkIntTs(:,1)+2/24; % correction for the timezone
% 'Cutting' the svkdata out between 'starttime' and 'endtime': tmp=svkIntTs(:,1); idx=(tmp>starttime & tmp<endtime); cutSerie=svkIntTs(idx,1:2);
%% Function fun=@(t)cutSerie*t;
%% Integral
q = integral(fun,starttime,endtime);

Accepted Answer

Steven Lord
Steven Lord on 9 Jul 2015
If you are trying to integrate data, not functions, I recommend using TRAPZ instead of trying to create some sort of function (which may or may not agree well with your data) to use with INTEGRAL.
  1 Comment
Azra Ferhatbegovic
Azra Ferhatbegovic on 10 Jul 2015
I'm not sure I know how to use it so I get the area I have marked. Within the timespace.. That's why I wanted to use the integral method.. But I'll try, thanks

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!