フィルターのクリア

normalise two plot by there area

3 ビュー (過去 30 日間)
Sung YunSing
Sung YunSing 2023 年 12 月 20 日
編集済み: Sung YunSing 2023 年 12 月 21 日
Hi everyone
I will get severals datas( e.g. nx100 double ) and going to plot on figure.
However, I need to normalise each data lines by their area.
Then plot the new datas on the figure.
I just know I can have the area of the plot by instruction: boundary.
But I have no idea to do the normalization parts.
Do you have any suggestions?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21/12 edit
sorry
may i clarify my question
for example
x=1:1:100;
y(1,:)=x;
y(2,:)=x/2;
y(3,:)=x/4;
%y consider as my three data
figure
for i=1:3
plot(x,y(i,:))
area(i)=trapz(y(i,:));
hold on
end
%here we can get a figure of data plots and their area (with x axis)
%we can notice the areas of three data are different
L=area(1)*area(2)*area(3);
%here is just a simple lcm.
figure
for j=1:3
Y(j,:)=y(j,:)*L/area(j);
plot(x,Y(j,:))
hold on
end
% Y would be the data i really want because the areas of the three data are
% same.
However, the lcm part (or normalise part) is quite inefficient when my data are too complex or large.
wondering is there another way to revise it.
  1 件のコメント
Torsten
Torsten 2023 年 12 月 20 日
I will get severals datas( e.g. nx100 double ) and going to plot on figure.
So you have n data lines ?
However, I need to normalise each data lines by their area.
The area between the data line and the x-axis ? What are the x-axis values corresponding to the 100 data of each of the n data lines ?

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

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 12 月 20 日
Briefly speaking normalizartion means to have the values of a variable with respect to "some value" , e.g.:
A = [5 2 3 10]
A = 1×4
5 2 3 10
% To normalize A w.r.t max value of A
A_normal = A/max(A)
A_normal = 1×4
0.5000 0.2000 0.3000 1.0000
figure(1)
plot(A, 'DisplayName','Original')
legend("Show")
figure(2)
plot(A_normal, 'DisplayName','Normalized')
legend("Show")

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by