how to define the curve by the area rather than area by the curve?

1 visualización (últimos 30 días)
I used ode45 to obtain a curve using certain parameters and using trapz I find its area. Now my intention is to obtain another curve of the same equation with different parameters but the area under curve must be same as previous graph.
How do I do it?
Thank you
  2 comentarios
Purush otham
Purush otham el 7 de Mayo de 2018
Is it possible to add an event or limit the second graph based on the trapz value obtained on the first graph?
Ameer Hamza
Ameer Hamza el 7 de Mayo de 2018
The only way to change area under a curve while keeping the shape same is to scale the curve by a suitable factor. All other transformation will also change the shape of the curve.

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 7 de Mayo de 2018
You can do it like this,
1) Solve the equation for the first curve (say curve1). Calculate the area under curve1 and let us call it Area1.
2) Solve the equation for the second curve (say curve2) using the different set of parameters. Calculate the area under the 2nd curve and call it Area2.
3) Now change curve2 using following formula
curve2 = curve2/Area2*Area1;
The modifies curve 2 will have the same area.
  5 comentarios
Ameer Hamza
Ameer Hamza el 7 de Mayo de 2018
Editada: Ameer Hamza el 7 de Mayo de 2018
You only need to scale the y values, not the x values. Run the following code, you will get the idea.
C1a=[1;2;3];
C1b=[7;8;9];
A1=trapz(C1a,C1b)
C2a=[4;5;6];
C2b=[0;1;2];
A2=trapz(C2a,C2b)
C3b=(C2b/A2)*A1; % divide the curve you want to scale, C2b will scale to have area equal to C1b
A3=trapz(C2a,C3b)
Purush otham
Purush otham el 8 de Mayo de 2018
Hi, Thanks a lot. It worked. Yet it would be nice to do the same using 'trapz' function. A loop that detects a particular trapz value and stops the ode45 from integrating further.
It does not matter if the shape of curve changes.

Iniciar sesión para comentar.

Más respuestas (0)

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!

Translated by