Issue regarding a data plot

조회 수: 5 (최근 30일)
Rahul
Rahul 2024년 8월 8일
댓글: Divyajyoti Nayak 2024년 8월 8일
Hi,
I have a data as attached herewith.
The blue plot represents the gradient while the orange plot represents the percentage difference between the two datapoints.
But as you can see that at distance 0.2 the orange plot shoots up although the blue plot is sufficiently smooth.
I don't see any noise or outliers present at that point.
Can you advice me a way how to correct the percentage profile in this case?
  댓글 수: 2
Divyajyoti Nayak
Divyajyoti Nayak 2024년 8월 8일
편집: Divyajyoti Nayak 2024년 8월 8일
Hi @Rahul, could you share the data or code you are using to plot this graph? That would help in debugging this.
Rahul
Rahul 2024년 8월 8일
Hi Divyajyoti,
Sure,
Plz find it as below
intensity_gradient = data.variable.gradintensity(end,:);
Normalized_intensity_gradient = data.variable.gradintensity(end,:)./abs(min(data.variable.gradintensity(end,:)));
grid on;
yyaxis left;
plot(data.variable.x,Normalized_intensity_gradient(end,:),'.', 'MarkerSize',10); %222
xlabel('Normalized radius');
ylabel('Normalized intensity gradient');
hold on;
for i = 1:length(data.variable.x)-1
percentage_difference_gI(i) = abs(Normalized_intensity_gradient(end,i+1)-Normalized_intensity_gradient(end,i))*200/abs(Normalized_intensity_gradient(end,i+1)+Normalized_intensity_gradient(end,i));
end
yyaxis right;
plot(data.variable.x(1,1:end-1),percentage_difference_gI(1,:),'.-', 'MarkerSize',10);
ylabel('% different point');
ylim([0,300]);
yticks(0:20:300);
line([0 1],[100 100], 'LineStyle','--','Color','black'); %line([x1 x2],[y1 y2])
txt1 = text(0.025, 110, 'H-mode criteria (% different point ≥ 100 %)', 'FontSize', 11);
[Value_percentage, index_percentage] = max(percentage_difference_gI);
txt2 = text(0.025, 90, strcat("Maximum of % different point = ", num2str(Value_percentage), ' %'), 'FontSize', 11);

댓글을 달려면 로그인하십시오.

채택된 답변

Divyajyoti Nayak
Divyajyoti Nayak 2024년 8월 8일
Hi Rahul, I think the reason your graph shoots up so suddenly is due to the way you have defined the ‘percentage_difference_gI’ vector.
percentage_difference_gI(i) = abs(Normalized_intensity_gradient(end,i+1)-Normalized_intensity_gradient(end,i))*200/abs(Normalized_intensity_gradient(end,i+1)+Normalized_intensty_gradient(end,i));
At distance 0.2, the gradient intensity is very close to 0. It is possible that the gradient intensity is crossing over from positive to negative. If this is the case then the numerator of your percentage will become larger than the denominator. For example,
Normalized_intensity_gradient(end,i+1) = 0.015;
Normalized_intensity_gradient(end,i) = -0.01;
percentage_difference_gI(i) = abs(0.015 – (-0.01))*200/ abs(0.015 + (-0.01));
percentage_difference_gI(i) = 0.025*200/0.005 = 1000
Here’s some code to show this visually with some dummy data:
data = -0.2:0.01:0.2;
percentage = abs(data(2:end)-data(1:end-1))./abs(data(2:end)+data(1:end-1));
percentage = percentage * 200;
plot(data(2:end),percentage);

추가 답변 (1개)

Rahul
Rahul 2024년 8월 8일
Hi Divyajyoti,
I tried to do the correction as follows
percentage_difference_gI(i) = abs(Normalized_intensity_gradient(end,i+1)-Normalized_intensity_gradient(end,i))*200/abs(Normalized_intensity_gradient(end,i+1)+Normalized_intensity_gradient(end,i));
if Normalized_intensity_gradient(end,i)<0
Normalized_intensity_gradient(end,i)=abs(Normalized_intensity_gradient(end,i));
end
But, this doesn't work. Can you advice please any other logic which can help.
  댓글 수: 1
Divyajyoti Nayak
Divyajyoti Nayak 2024년 8월 8일
Hey @Rahul, I'm not sure what your aim is exactly. Your expression for percentage difference is finding the percentage with respect to the average of 2 data points not the percentage increase from one data point to another. According to me, a simple percentage expression would be something like this:
percentage_difference_gI = (Normalized_intensity_gradient(end,2:end)-Normalized_intensity_gradient(end,1:end-1))./Normalized_intensity_gradient(end,1:end-1);
percentage_difference_gI = abs(percentage_difference_gI)*100;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by