How to add color bar for streamslice plot?

2 views (last 30 days)
Jagadeesh Korukonda
Jagadeesh Korukonda on 11 Jul 2022
Answered: Suman on 16 Jan 2023
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

Answers (1)

Suman
Suman on 16 Jan 2023
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

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!