Скачиваний:
23
Добавлен:
14.06.2022
Размер:
3.6 Кб
Скачать
clc;
I=100;
m=600;
Ib=I*(m-1)/(m+1);
I0=2*I/(m+1);
R=0.5;
a=1.25;
b=0.35;
D=0.016;
XA1=a+b;
XA=a;
XB=(R^2)/a;
XB1=(R^2)/(a+b);
x=-1:0.001:3;
h1=x-x;
h2=x-x;
h3=x-x;
h4=x-x;

for i=1:length(x)
if ((x(i)>=(XA1-0.5*D)) && (x(i)<=(XA1+0.5*D)))
h1(i)=I*(XA1-x(i))/(2*pi*(0.25*D^2));
else
if ((x(i)>=-R) && (x(i)<=R))
h1(i)=I0/(2*pi*(XA1-x(i)));
else
h1(i)=I/(2*pi*(XA1-x(i)));
end
end
end

for i=1:length(x)
if ((x(i)>=(XA-0.5*D)) && (x(i)<=(XA+0.5*D)))
h2(i)=-I*(XA-x(i))/(2*pi*(0.25*D^2));
else
if ((x(i)>=-R) && (x(i)<=R))
h2(i)=-I0/(2*pi*(XA-x(i)));
else
h2(i)=-I/(2*pi*(XA-x(i)));
end
end
end
for i=1:length(x)
if ((x(i)>=-R) && (x(i)<=R))
h3(i)=0;
else
h3(i)=-Ib/(2*pi*(XB-x(i)));
end
end

for i=1:length(x)
if ((x(i)>=-R) && (x(i)<=R))
h4(i)=0;
else
h4(i)=Ib/(2*pi*(XB1-x(i)));
end
end

H1=h1+h2+h3+h4;

for i=1:length(x)
if ((x(i)>=(XA1-0.5*D)) && (x(i)<=(XA1+0.5*D)))
h5(i)=I*(XA1-x(i))/(2*pi*(0.25*D^2));
else if ((x(i)>=-R) && (x(i)<=R))
shtuka1=0;
for k=1:1000
slag=x(i).^(k-1)/(XA1^(k));
shtuka1=shtuka1+slag;
end
h5(i)=I/(pi*(m+1))*shtuka1;
else
h5(i)=I/(2*pi*(XA1-x(i)));
end
end
end


for i=1:length(x)
if ((x(i)>=(XA-0.5*D)) && (x(i)<=(XA+0.5*D)))
h6(i)=-I*(XA-x(i))/(2*pi*(0.25*D^2));
else if ((x(i)>=-R) && (x(i)<=R))
shtuka2=0;
for k=1:1000
slag=x(i).^(k-1)/(XA^(k));
shtuka2=shtuka2+slag;
end
h6(i)=-I/(pi*(m+1))*shtuka2;
else
h6(i)=-I/(2*pi*(XA-x(i)));
end
end
end



for i=1:length(x)
if ((x(i)>=-R) && (x(i)<=R))
h7(i)=0;
else
shtuka3=0;
for k=1:1000
slag=R^(2*k)/(XA^(k) * x(i)^(k+1));
shtuka3=shtuka3+slag;
end
h7(i)=(Ib/(2*pi))*shtuka3;
end
end


for i=1:length(x)
if ((x(i)>=-R) && (x(i)<=R))
h8(i)=0;
else
shtuka4=0;
for k=1:1000
slag=R^(2*k)/(XA1^(k).*x(i).^(k+1));
shtuka4=shtuka4+slag;
end
h8(i)=(-Ib/(2*pi))*shtuka4;
end
end

H2=h5+h6+h7+h8;




figure
hold on
grid on
set(gca, 'box', 'on');
set(gca,'FontSize',14);

plot(x,H1,'-k','LineWidth',1.3);
plot(x,H2,'--','LineWidth',1.3,'color',[0.75 0.75 0.75]);
xlabel('x, m', 'FontSize', 22);
ylabel('H_{y}(x), A/m', 'Rotation', 0, 'FontSize', 22, 'Position', [-1.25 0 0]);
clear xlim;


LH(1) = plot(nan, nan, '-k','LineWidth',1.3,'color',[0 0 0]);
LH(2) = plot(nan, nan, '--','LineWidth',1.3,'color',[0.75 0.75 0.75]);
L{1} = 'method of images';
L{2} = 'method of the variable separation';
legend(LH,L);

figure
hold on
grid on
set(gca, 'box', 'on');
set(gca,'FontSize',14);

plot(x,log10(abs(H1)),'-k','LineWidth',1.3);
plot(x,log10(abs(H2)),'--','LineWidth',1.3,'color',[0.75 0.75 0.75]);
xlabel('x, m', 'FontSize', 22);
ylabel('lg(|H_{y}(x)|)', 'Rotation', 0, 'FontSize', 22, 'Position', [-1.12 0 0]);
set(gca,'XTick',(-1:0.1:1));
clear xlim;
xlim([-1 1]);

LH(1) = plot(nan, nan, '-k','LineWidth',1.3,'color',[0 0 0]);
LH(2) = plot(nan, nan, '--','LineWidth',1.3,'color',[0.75 0.75 0.75]);
L{1} = 'method of images';
L{2} = 'method of the variable separation';
legend(LH,L);


Соседние файлы в папке Графики в матлабе+эксель