フィルターのクリア

How to overlay two surf plots?

32 ビュー (過去 30 日間)
LEONG SING YEW
LEONG SING YEW 2020 年 3 月 14 日
コメント済み: LEONG SING YEW 2020 年 3 月 22 日
Hi everyone,
I am trying to overlay the contour stroke shape into the colorful surf plot
Here the code i've tried but it doesnt work, it only show the left image above
hold on
surf(X,Y,-M1); surf(-X,Y,M1); %Reflection along y axis
surf(X,Y,Ta); surf(-X,Y,Ta); %Stroke Contour
  4 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 15 日
It would help if we had your data to work with -- X, Y, and M1 and Ta
LEONG SING YEW
LEONG SING YEW 2020 年 3 月 15 日
Yes you may have my code and my data in the csv attachment,
The picture shown is what i'm trying to do: to overlay the black stroke of the flame front on the colorful surf plot
colormap jet
%{
Read data
%}
filename0 = '0.csv';
Data0 = csvread(filename0,6,0);
filename1 = '360.csv';
Data1 = csvread(filename1,6,0);%skip 6 header lines
%{
Data Extraction
%}
X_Data = Data0(:,2); Y_Data = Data0(:,1); %x and y coordinates
%Extract both temperature and x-velocity data
T_Data0 = Data0(:,8); V_Data0 = Data0(:,9);
T_Data1 = Data1(:,8); V_Data1 = Data1(:,9);
V_Data1 = V_Data1-V_Data0; %Fluctuation velocity, v'
V_Data1(T_Data1>400)=0; %Temperature outside the flame front is not considered
T_1=V_Data1-1; %Create flame front stroke by darken it using caxis later, or any alternative method
T_1(T_Data1>500)=NaN; T_1(T_Data1<325)=NaN; %Only circumference of flame front is needed
%{
Surf
%}
[x,~,xi]=unique(X_Data*1e3/2); %convert m to mm
[y,~,yi]=unique(Y_Data*1e3/2);
subs=[xi yi];%use the indices instead of values as coordinates
[X,Y]=ndgrid(x,y);%generate the grid surf() expects
Ta =accumarray(subs,T_1,[],[],NaN);
M1=accumarray(subs,V_Data1,[],[],NaN);%fill missing with NaN
hold on
surf(-X,Y,M1); surf(X,Y,-M1); %Reflection along y-axis
surf(-X,Y,Ta); surf(X,Y,Ta); %Stroke Contour
shading interp; c=colorbar;
xlim([-2 2]); ylim([-0.5 3.4]);
xlabel("x/R (mm)"+newline);ylabel("y/R (mm)"+newline)
title(c,"v'/U_o",'FontSize',9,'FontWeight','bold');
title('Phase = 0\circ')
caxis([-.1 .1]) %Set the range
view(0,90);

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 3 月 16 日
view(0,-90)
  4 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 22 日
plot() creates a 3D plot with empty Z components, and that in turn is treated the same as if the Z components were all 0. You can use plot3() to provide explicit Z coordinates; you would want to use a Z larger than the largest Z in the surf plot.
I wonder if pcolor() would be better than surf() for your purpose? pcolor is a surface plot underneath, but it creates a surface in which all the Z are 0 and the color data is set according to the Z data that was passed to pcolor(). Using Z all 0 can make it easier to draw things on top of it.
LEONG SING YEW
LEONG SING YEW 2020 年 3 月 22 日
omg, i didn't know this command "pcolor" exist, amazing!!! Thank you so much!!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by