The picture is attached
I want to make the figure hanger look like the attached picture. The code is shown below.
1 view (last 30 days)
Show older comments
clc
L=3;% L=y fare away the the plate (boundary layer)
T=2;%Final time
maxk=500;%Number of time steps
dt=T/maxk;
n=50;%Number of space steps
dy=L/n;
diff=0.25;
b=diff*dt/(dy*dy);
%b=0.1;
%initial condition of velocity
for i=1:n+1
y(i)=(i-1)*dy;
u(1,1)=0;
end
%Boundary condition
for k=1:maxk+1
u(1,k)=1;
u(n+1,k)=0;
end
for k=1:maxk %time loop
for i=2:n %space loop
u(i,k+1) =u(i,k)+b*(u(i-1,k)+u(i+1,k)-2.*u(i,k));
end
end
%Ploting
figure(1)
%plot(y,u(:,1),'-',y,u(:,100),'-',y,u(:,300),'-',y,u(:,600),'-')
plot(y,u(:,50),'-',y,u(:,100),'-',y,u(:,200),'-',y,u(:,250),'-')
%legend('dt=50','dt=100','dt=200','dt=250')
title('Velocity in the boundary layer')
xlabel('y')
ylabel('velocity')
2 Comments
Answers (1)
Walter Roberson
on 26 Aug 2021
Instead of using plot() use surf(), with 'edgecolor', 'none', and with 'alphadata' set to a constant repeated the same size as u, and with AlphaDataMapping 'none' and with 'FaceAlpha', 'flat'
3 Comments
Walter Roberson
on 26 Aug 2021
surf(x, y, u, 'edgecolor', 'none', 'AlphaDataMapping', 'none', 'FaceAlpha', 'flat', 'Alpha', 0.8 * ones(size(u)));
hold on
This would be in a loop in which you changed whatever it is you need to change, creating a new u matrix each time.
See Also
Categories
Find more on Logical 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!