How to add color bar for streamslice plot?

2 次查看(过去 30 天)
i want to know intensity of streamlines, so i need color bar for streamslice plot. can anyone help in this regard.
clc, clear, close;
X = linspace(0,1.5);
Z = linspace(-3,3);
r = linspace(0,1);
[z,x] = meshgrid(Z,X);
ui = -0.04545*x.^2.*z;
vi = x.*(-.04545 + .0909091*x.^2 + 0.04545*z.^2);
figure('units','normalized','outerposition', [0 0 1 1])
hold on
streamslice(z,x,vi,ui,'noarrows')
plot(sqrt(1-r.^2),r,'r','LineWidth',2);
plot(-sqrt(1-r.^2),r,'r','LineWidth',2);
hold off
axis image

回答(1 个)

Suman
Suman 2023-1-16
clc, clear, close;
X = linspace(0,1.5);
Z = linspace(-3,3);
r = linspace(0,1);
[z,x] = meshgrid(Z,X);
ui = -0.04545*x.^2.*z;
vi = x.*(-.04545 + .0909091*x.^2 + 0.04545*z.^2);
figure('units','normalized','outerposition', [0 0 1 1])
hold on
A = streamslice(z,x,vi,ui,'noarrows');
set(A,'LineWidth',2); % linewidth of streamslice line
set(A,'Color','b'); % for line color of streamslice line
plot(sqrt(1-r.^2),r,'r','LineWidth',2);
plot(-sqrt(1-r.^2),r,'r','LineWidth',2);
hold off
axis image

类别

Help CenterFile Exchange 中查找有关 Volume Visualization 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by