1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| clear all, clc
%%
VThetaDeg = 0:1:360;
VTheta = VThetaDeg *pi / 180;
X_centre = 1:10:151;
Y_centre = 20*ones(1,length(X_centre));
Rmax = 10;
Rmin = 3;
Rayon = zeros(1,length(X_centre));
x_depart = X_centre(1);
X_fin = X_centre(end-1);
for n = 1:length(X_centre)-1
X=X_centre(n);
Rayon(n) = (((X-x_depart)*(Rmax-Rmin))/(X_fin-x_depart))+Rmin;
end
Rayon(length(X_centre))=2; %Rayon ajouté
[a,b,~] = unique(Rayon);
cmap = parula(max(b));
set(gcf, 'colormap', cmap)
hold on
for k = 1:length(X_centre)
XCercle = X_centre(k) + Rayon(k) * cos(VTheta);
YCercle = Y_centre(k) + Rayon(k) * sin(VTheta);
h = fill(XCercle, YCercle, 'r');
set(h,'facecolor', cmap(b(k),:))
end
axis equal
c=colorbar
% c=colorbar; colormap(jet)
yl = get(c, 'ylim');
yt = linspace(yl(1), yl(2), 2*numel(a)+1);
set(c, 'ytick', yt(2:2:end-1), 'yticklabel', num2str(a(:))) |
Partager