I want to fill color in the circle

조회 수: 2 (최근 30일)
Shreen El-Sapa
Shreen El-Sapa 2022년 2월 4일
댓글: Shreen El-Sapa 2022년 2월 4일
Zeta1=10;Zeta2=0.1;
%k=0.000001;U=1;
%k=1;U=1;
%k=3;U=1;
k=4;U=1;
alpha1=real(sqrt(Zeta1.^2./2+Zeta1.*sqrt(Zeta1.^2-4.*k.^2)./2));
alpha2=real(sqrt(Zeta1.^2./2-Zeta1.*sqrt(Zeta1.^2-4.*k.^2)./2));
a = 1 ; %RADIUS
L=.4;
c =-a/L;
b =a/L;
m =a*200; % NUMBER OF INTERVALS
[x,y]=meshgrid([c:(b-c)/m:b],[c:(b-c)/m:b]');
[I J]=find(sqrt(x.^2+y.^2)<(a-.1));
if ~isempty(I);
x(I,J) = 0;
y(I,J) = 0;
end
r=sqrt(x.^2+y.^2);
t=atan2(y,x);
warning on
AA = -(a .^ 3 .* alpha1 .^ 2 .* alpha2 .^ 2 + 3 .* a .^ 2 .* alpha1 .^ 2 .* alpha2 + 3 .* a .^ 2 .* alpha1 .* alpha2 .^ 2 + 3 .* a .* alpha1 .^ 2 + 6 .* a .* alpha1 .* alpha2 + 3 .* a .* alpha2 .^ 2 + 3 .* alpha1 + 3 .* alpha2) .* U ./ alpha2 .^ 2 ./ alpha1 .^ 2;
BB = -0.3e1 .* exp(a .* alpha1) .* sqrt(a .* alpha1) .* (a .* alpha2 + 0.1e1) .* sqrt(0.2e1) .* U ./ alpha1 .* pi .^ (-0.1e1 ./ 0.2e1) .* a .^ (-0.1e1 ./ 0.2e1) ./ (alpha1 - alpha2);
CC = 0.3e1 .* sqrt(0.2e1) .* exp(a .* alpha2) .* (a .* alpha1 + 0.1e1) .* sqrt(a .* alpha2) .* U .* pi .^ (-0.1e1 ./ 0.2e1) .* a .^ (-0.1e1 ./ 0.2e1) ./ alpha2 ./ (alpha1 - alpha2);psi=(BB .* sqrt(0.2e1) .* sqrt(pi) .* exp(-alpha1 .* r) .* sqrt(alpha2 .* r) .* alpha1 .* alpha2 .* r .^ 2 + CC .* sqrt(0.2e1) .* sqrt(pi) .* sqrt(alpha1 .* r) .* exp(-alpha2 .* r) .* alpha1 .* alpha2 .* r .^ 2 + BB .* sqrt(0.2e1) .* sqrt(pi) .* exp(-alpha1 .* r) .* r .* alpha2 .* sqrt(alpha2 .* r) + CC .* sqrt(0.2e1) .* sqrt(pi) .* exp(-alpha2 .* r) .* r .* alpha1 .* sqrt(alpha1 .* r) + 0.2e1 .* AA .* sqrt(r) .* alpha1 .* sqrt(alpha1 .* r) .* alpha2 .* sqrt(alpha2 .* r)) .* r .^ (-0.3e1 ./ 0.2e1) ./ alpha1 .* (alpha1 .* r) .^ (-0.1e1 ./ 0.2e1) ./ alpha2 .* (alpha2 .* r) .^ (-0.1e1 ./ 0.2e1) .* sin(t) .^ 2 ./ 0.4e1;
p1=contour(x,y,psi,[-0.1 -0.1],'k','LineWidth',1.1,'ShowText','on'); %,'ShowText','on'
hold on
p2=contour(x,y,psi,[-0.2 -0.2],'--k','LineWidth',1.1,'ShowText','on');
hold on
p3=contour(x,y,psi,[-0.3 -0.3],'r','LineWidth',1.1,'ShowText','on');
hold on
p4=contour(x,y,psi,[-0.4 -0.4],'--r','LineWidth',1.1,'ShowText','on');
hold on
p5=contour(x,y,psi,[-0.5 -0.5],'m','LineWidth',1.1,'ShowText','on');
hold on
p6=contour(x,y,psi,[-.8 -.8],'--m','LineWidth',1.1,'ShowText','on');
hold on
p7=contour(x,y,psi,[-1 -1],'b','LineWidth',1.1,'ShowText','on');
hold on
p8=contour(x,y,psi,[-1.2 -1.2],'--b','LineWidth',1.1,'ShowText','on');
hold on
p9=contour(x,y,psi,[-1.3 -1.3],'g','LineWidth',1.1,'ShowText','on');
hold on
p10=contour(x,y,psi,[-1.5 -1.5],'--g','LineWidth',1.1,'ShowText','on');
hold on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m1=100;
r1=ones(1,m1+1)*a;
th=[0:2*pi/m1:2*pi];
set(polar(th,r1,'-k'),'LineWidth',1.1);
%title('$\kappa=0.0$','Interpreter','latex','FontSize',12,'FontName','Times New Roman','FontWeight','Normal')
%title('$\kappa=1.0$','Interpreter','latex','FontSize',12,'FontName','Times New Roman','FontWeight','Normal')
%title('$\kappa=3.0$','Interpreter','latex','FontSize',12,'FontName','Times New Roman','FontWeight','Normal')
title('$\kappa=4.0$','Interpreter','latex','FontSize',12,'FontName','Times New Roman','FontWeight','Normal')
axis equal %square
axis off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

채택된 답변

Simon Chan
Simon Chan 2022년 2월 4일
Add these 2 lines after your polar command:
set(polar(th,r1,'-k'),'LineWidth',1.1);
[xx,yy]=pol2cart(th,r1);
fill(xx,yy,'r')
  댓글 수: 4
Simon Chan
Simon Chan 2022년 2월 4일
Use the following:
fill(xx,yy,[0.5 0.5 0.5])
Shreen El-Sapa
Shreen El-Sapa 2022년 2월 4일
All thanks for you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by