how can I plot the contours inside not outside?

2 vues (au cours des 30 derniers jours)
Shreen El-Sapa
Shreen El-Sapa le 16 Août 2023
Commenté : Star Strider le 16 Août 2023
clc
A =[ 0.506207
-1.175631
3.791971
-8.367277
15.218631
-24.775942
37.354122
-53.596046
73.775154
-98.864357
128.993118
-165.690033
208.780502
-260.760254
320.860199
-393.309998
476.185974
-576.973877
691.446899
-833.655273
994.502441
-1202.786865
1438.045410
-1768.520142
2142.382813
-2773.383545
3490.939697
-5789.086914
8474.064453
-4602.666992];
B=[ -1.898113
1.420040
-2.795280
4.554918
-6.620665
9.012413
-11.705348
14.778024
-18.184662
22.053255
-26.295725
31.114862
-36.357929
42.347446
-48.827950
56.320488
-64.398186
73.929947
-84.185623
96.693771
-110.143478
127.466537
-146.105637
172.564941
-201.088440
250.779495
-304.517883
487.777771
-690.493896
363.089630];
C=[ -4.395421
7.855587
-14.091352
13.265227
-8.180313
3.734594
-1.344997
0.401312
-0.101679
0.022491
-0.004390
0.000771
-0.000122
0.000018
-0.000002
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000];
AA=[ 0.239048
0.007455
-0.001080
0.000172
-0.000024
0.000003
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000];
BB=[ -0.000673
-0.000037
0.000007
-0.000001
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000];
CC=[ 0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
-0.000001
0.000003
-0.000010
0.000012];
a = 1 ; %RADIUS
L=.5;
akm=2;gamma=0.3;arh=10; %beta1=beta2=1,a1=1,a2=2,arh=10,delta=0.5,u2=-1
alphaa=sqrt(((2+akm).*akm./(gamma.*(2+akm))).^2+arh.^2);
betaa=(2.*akm.*arh.^2./gamma).^(0.25);
alpha1=sqrt((alphaa.^2+sqrt(alphaa.^4-4.*betaa.^4))./2);
alpha2=sqrt((alphaa.^2-sqrt(alphaa.^4-4.*betaa.^4))./2);
dd=.6;
c =-a/L;
b =2; %a/L;
m =a*200; % NUMBER OF INTERVALS
[x,y]=meshgrid((dd:(b-c)/m:b),(0:(b-c)/m:b)');
[I, J]=find(sqrt(x.^2+y.^2)<(a-0.1));
if ~isempty(I)
x(I,J) = 0; y(I,J) = 0;
end
r=sqrt(x.^2+y.^2);
t=atan2(y,x);
r2=sqrt(r.^2+dd.^2-2.*r.*dd.*cos(t));
zet=(r.^2-r2.^2-dd.^2)./(2.*r2.*dd);
warning on
psi1=0;
for i=2:7
Ai=A(i-1);Bi=B(i-1);Ci=C(i-1);AAi=AA(i-1);BBi=BB(i-1);CCi=CC(i-1);
%psi1=-psi1-(Ai.*r.^(-i-1)+r.^(-3./2).*besselk(i-1./2,r.*alpha1).*Bi+r.^(-3./2).*besselk(i-1./2,r.*alpha2).*Ci).*legendreP(i-1,cos(t))-(AAi.*r2.^(-i-1)+r2.^(-3./2).*besselk(i-1./2,r2.*alpha1).*BBi+r2.^(1./2).*besselk(i-1./2,r2.*alpha2).*CCi).*legendreP(i-1,zet);
psi1=psi1+(Ai.*r.^(-i+1)+r.^(1./2).*besselk(i-1./2,r.*alpha1).*Bi+r.^(1./2).*besselk(i-1./2,r.*alpha2).*Ci).*gegenbauerC(i,-1./2, cos(t))+(AAi.*r2.^(-i+1)+r2.^(1./2).*besselk(i-1./2,r2.*alpha1).*BBi+r2.^(1./2).*besselk(i-1./2,r2.*alpha2).*CCi).*gegenbauerC(i,-1./2,zet);
end
hold on
[DH1,h1]=contour(x,y,psi1,25,'--r','LineWidth',1.1); %,psi2,'--k',psi2,':k'
%[DH1,h1]=contour(x,y,psi1);
%p1=contour(x,y,psi1,[0.01 0.01],'k','LineWidth',1.1); %,'ShowText','on'
%p2=contour(x,y,psi1,[0.05 .05],'r','LineWidth',1.1);
%p3=contour(x,y,psi1,[0.1 0.1],'g','LineWidth',1.1);
%p4=contour(x,y,psi1,[0.4 0.4],'b','LineWidth',1.1);
%p5=contour(x,y,psi1,[0.6 0.6],'c','LineWidth',1.1);
%p6=contour(x,y,psi1,[0.8 0.8],'m','LineWidth',1.1);
%clabel(DH1,h1,'FontSize',10,'Color','red')
%%%%%%%%%%%%%%% $\frac{\textstyle a_1+a_2}{\textstyle h}=6.0,\;
hold on
t3 = linspace(0,pi,1000);
h2=0;
k2=0;
rr2=2;
x2 = rr2*cos(t3)+h2;
y2 = rr2*sin(t3)+k2;
set(plot(x2,y2,'-k'),'LineWidth',1.1);
fill(x2,y2,'w')
hold on
t2 = linspace(0,pi,1000);
h=dd;
k=0;
rr=1;
x1 = rr*cos(t2)+h;
y1 = rr*sin(t2)+k;
set(plot(x1,y1,'-k'),'LineWidth',1.1);
fill(x1,y1,'w')
%axis square;
axis('equal')
box on
%set(gca,'XTick',[], 'YTick', [])
axis on
xticklabels([])
yticklabels([])
%legend('0.01','0.05','0.1','0.4','0.6','0.8','Location','northwest')

Réponses (1)

Star Strider
Star Strider le 16 Août 2023
What result do you want?
Try this —
figure
F = openfig('untitled.fig');
Lines = findobj(F, 'Type','line');
for k = 1:numel(Lines)
L{k}(1,:) = Lines(k).XData;
L{k}(2,:) = Lines(k).YData;
end
hold on
patch([L{1}(1,:) flip(L{2}(1,:))], [L{1}(2,:) flip(L{2}(2,:))], 'g', 'FaceAlpha',0.5)
hold off
The red dashed lines do not appear as ‘line’ objects in the .fig file. (I do not know what else they could be.) I do not see any plot or contour calls in the code that specifically plot them, either.
.
  5 commentaires
Shreen El-Sapa
Shreen El-Sapa le 16 Août 2023
I think it is ok now.
Thanks so much
Star Strider
Star Strider le 16 Août 2023
My pleasure!
If my Answer helped you solve your problem, please Accept it!
F = openfig('untitled.fig');
.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by