Gray Color Intensity fill.
Show older comments
I need some assistance on the problem described below. I believe it is more clearer than the earlier post.
%% Problem Description.
% This code represent a 2D spray divided into 5 layers.
% X(SL) represent the axial length,Y(h), the radial length and Z represent the AFR(air-fuel-ratio).
% My intention is to generated a gray color intensity using the Z(AFR) matrix and then distribute
% it into these 5 zones instead of using the FaceColor "y,y,y,y,y" in the code.
% My attempt to use mat2gray,imagesc did not yield any fruit.
% The rsult should be real-time since the variables X,Y and Z are prone to change.
% (The data files for X,Y and Z currently used are attached)
% Color Intensity variation over area stack.
L=5;
for j=1:L % L is the number of layers.
X(j,:)=SL(j,:); % represent the axial length of spray zones
Y(j,:)=h(j,:); % axial length of spray zones
Z(j,:)=AFR(j,:); % Air -fuel Ratio
end
% I = mat2gray(Z,[0 max(max(Z))]);
% imshow(I, []);
Color=['y' 'y' 'y' 'y' 'y'];
figure(14)
hold on
for j=L:-1:1
Ar(j,:)=area(X(j,:)*1000,(Y(j,:)*1000),'FaceColor',Color(j));
Ar(j,:)=area(X(j,:)*1000,(Y(j,:)*1000)*-1,'FaceColor',Color(j));
end
axis([0 350 -100 100]);
grid on
box on
set(gca,'linewidth',1)
xlabel('X [mm]');
ylabel('Y [mm]')
2 Comments
Guillaume
on 1 Jul 2019
Unfortunately, code that doesn't do what you want doesn't help much in understanding what you want it to do.
If I understood correctly, you want to colour a spray divided into zones according to the AFR. What is the shape of the spray (conical/triangular in 2D)? What is the shape of the zones?
I don't really understand what your SL and h array represent. A drawing of the spray and the zones would help.
Note that:
for j=1:L % L is the number of layers.
X(j,:)=SL(j,:); % represent the axial length of spray zones
Y(j,:)=h(j,:); % axial length of spray zones
Z(j,:)=AFR(j,:); % Air -fuel Ratio
end
is simply:
X = SL; Y = h; Z = AFR;
and really, there's no point in renaming variables, you could simply use SL, h, and AFR wherever you're using X, Y and Z.
DAVID OYUGI
on 1 Jul 2019
Accepted Answer
More Answers (1)
DAVID OYUGI
on 6 Jul 2019
0 votes
Categories
Find more on White in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!