How to Integrate these data ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi All
I have a Diagram of Data x-y like this :
and the integration should look like :
having the Data of the first diagram as :
x=[0: 0.06] , you choose the step
and y = [-0.062847398, -0.057017095, -0.048434094, -0.03892462, -0.030365732, -0.023723144, -0.019435892, -0.017256826, -0.01674607, -0.01734093, -0.018578755, -0.020101786, -0.021674287, -0.023155192, -0.024468152, -0.025585016, -0.026502747, -0.027236393, -0.027807428, -0.02824128, -0.028562468, -0.028794073, -0.028956106, -0.029065736, -0.029136971, -0.029181112, -0.0292069, -0.029220911, -0.029227789, -0.029230507, -0.029230507, -0.029227789, -0.029220911, -0.0292069, -0.029181112, -0.029136971, -0.029065736, -0.028956106, -0.028794073, -0.028562468, -0.02824128, -0.027807429, -0.027236391, -0.026502745, -0.025585016, -0.024468152, -0.023155192, -0.021674288, -0.020101786, -0.018578757, -0.01734093, -0.01674607, -0.017256826, -0.019435894, -0.023723146, -0.030365737, -0.038924627, -0.048434086, -0.057017088, -0.062847398]
How can I integrate on these data so I will have more or less the same final amount of the integration that you see on the second graph : -2e-3 ? I know that my data are not precisely similar as the first graph , but I just would like to know how to do the integration with these data ? thank you
0 comentarios
Respuesta aceptada
pfb
el 14 de Abr. de 2015
Editada: pfb
el 14 de Abr. de 2015
You could use "cumptrapz". For that you'll need to provide both x and y.
In this respect, what do you mean "you choose the step"? If there is "a step" it will be something like the integration integral over the number of sampled points...
7 comentarios
pfb
el 14 de Abr. de 2015
Editada: pfb
el 14 de Abr. de 2015
You could read the documentation for cumtrapz, to begin with. Do you want to learn how to do things, or are you just having other people solve your homeworks?????????
The documentation pops up when you type "help cumtrapz" or "doc cumtrapz".
In general the function needs to know the abscissae as well, as I mention above. The result depends on that too. Therefore it should be
I = cumtrapz(x,y);
I think you know the abscissae, otherwise how could you plot the figure in the first place?
If you just need the integral on the whole interval (as opposed to the second plot) you could use trapz, as suggested by Torsten.
I = trapz(x,y);
If you do not want to bother with x, and you know the (fixed) step between subsequent points, you can use
I = dx*trapz(y)
Más respuestas (0)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation 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!