Using Trapz on datetime
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I have this graph with the Power value on the y-axis and the datetime on the x-axis (overall a week is shown). I want to caluculate various areas below the curves and plot these. Up to now, I have used the "fill" function to do so, but in the last graph I need to calculate the area beneath one curve dependent on the area beneath another of the curves.
I don't know how to create that dependency with fill, or how to actually evaluate the integral that the fill function shows.
Now I saw that I could use the trapz function to calculate the integral, but somehow that does not plot a graph when I use it. I do not get an error message, but I don't get a plot either. What can I do?
I have also tried to convert the datetime values to datenum, I thought that might be the problem, but that does not work either!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/831050/image.png)
9 comentarios
dpb
el 15 de Dic. de 2021
I'm extremely pressed for time at the moment, so don't have time to delve into the guts of the above myself at the moment, but somebody else may come along before I can get back...
However, from your above description, if you have boundaries of these areas defined so that you can use fill to color the areas desired, then perhaps polyshape and its companion area may solve your problem. They, too, will require the time axis variable be treated as a double, but if you have a set of vertices, the above may be more direct route to your goal.
Respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!