How to get the length of flame front

조회 수: 2 (최근 30일)
LEONG SING YEW
LEONG SING YEW 2020년 3월 13일
편집: LEONG SING YEW 2020년 3월 21일
Hi everyone, does anyone know how to code for measuring the length of flame front as seen in the picture above?
My lecturer suggest to me use everyone point (x,y) of the respective temperature to calculate the distance, i'm very new to coding, i appreaciate any help
Here is my csv attachments and matlab code for this 2D surf contour plot
filename = '40um.csv';
Data = csvread(filename,6,0); %read csv data
X_Data = Data(:,2);
Y_Data = Data(:,1);
T_Data = Data(:,6);
T_Data(T_Data>400)=300; %more than 400K equal to 300
[x,~,xi]=unique(X_Data*1e3/2); %convert m to mm
[y,~,yi]=unique(Y_Data*1e3/2); %option: divide by 2 to use for validations
subs=[xi yi];%use the indices instead of values as coordinates
[X,Y]=ndgrid(x,y);%generate the grid surf() expects
val=T_Data;
M=accumarray(subs,val,[],[],NaN);%fill missing with NaN
surf(X,Y,M);
surf(-X,Y,M); %Reflection along y-axis
colormap jet
view(0,90),xlabel("x/R (mm)"+newline),ylabel("y/R (mm)"+newline)
xlim([-2 2]); ylim([-0.5 3.4]); c=colorbar;
title(c,"Temperature",'FontSize',9,'FontWeight','bold'); title('0\circ');
shading interp

채택된 답변

darova
darova 2020년 3월 14일
You have to find first value in each column
ii = zeros(columns,1)
jj = 1:columns;
for j = 1:columns
ii(j) = find(M(:,j)>200,1,'last');
end
L = hypot(diff(jj),diff(ii));
  댓글 수: 1
LEONG SING YEW
LEONG SING YEW 2020년 3월 21일
편집: LEONG SING YEW 2020년 3월 21일
thanks i work it out with another method, i post here if anyone find it useful
[A B]=size(T_Data);
X_new = zeros(A,1); Y_new = zeros(A,1);
for i = 1:A;
if T_Data(i,:)>350;
X_new(i) = X_Data(i); %retain the value
Y_new(i) = Y_Data(i);
else
continue
end
end
XY = [X_new*1e3 Y_new*1e3];
rows = find(XY(:,2)==0);
XY(rows,:)=[]; %eliminate rows with value zeros
[~,idx] = unique(XY(:,2)); %which rows have a unique first value
XY = XY(idx,:); %retain them
[~,idy] = unique(XY(:,1));
XY = XY(idy,:);
X = XY(:,1);
Y = XY(:,2);
L = sum(hypot(diff(X),diff(Y))); %length of flame
hold on
plot(-X,Y); plot(X,Y);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by