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

1 回表示 (過去 30 日間)
Purush otham
Purush otham 2018 年 5 月 7 日
コメント済み: Purush otham 2018 年 5 月 8 日
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 件のコメント
Purush otham
Purush otham 2018 年 5 月 7 日
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 2018 年 5 月 7 日
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.

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 5 月 7 日
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 件のコメント
Ameer Hamza
Ameer Hamza 2018 年 5 月 7 日
編集済み: Ameer Hamza 2018 年 5 月 7 日
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 2018 年 5 月 8 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by