如何在MATLAB中编写?

时间:2017-08-02 06:36:08

标签: matlab iteration

我解决了NRW(Nicholson-Ross-Weir转换方法)转换方法,我找到了epsilonr(Er)。

NRW转换方法

clc
clear all
% yansima_genlik= input('Genliği giriniz =')
yansima_genlik= .856;
%disp(['Genlik: ' num2str(yansima_genlik) ' dir. '])
%yansima_faz= input('Fazı giriniz =')
yansima_faz= 163.2;
%disp(['Faz açısı: ' num2str(yansima_faz) ' dir. '])


s11 = yansima_genlik*cosd(yansima_faz)+i*yansima_genlik*sind(yansima_faz);
s22 = s11;

%gecis_genlik= input('Genliği giriniz =')
gecis_genlik= .609;
%disp(['Genlik: ' num2str(gecis_genlik) ' dir. '])
%gecis_faz= input('Fazı giriniz =')
gecis_faz= -140.5;
%disp(['Faz açısı: ' num2str(gecis_faz) ' dir. '])

s21 = gecis_genlik*cosd(gecis_faz)+i*gecis_genlik*sind(gecis_faz);
s12 = s21;
f= 8*10^9;

l=0.4; %örnek uzunluğu

fc=5.26*10^9; %kesim frekansı

lamda0 = 3.75;
lamdac = 5.703;

x = (s11^2-s21^2+1)/(2*s11)

yansima1 = x + sqrt(x^2-1)
yansima2 = x - sqrt(x^2-1)

iletim = (s11+s21-yansima1)/(1-(s11+s21)*yansima1)

a = log(1/iletim) 

b = -(((1/(2*pi*l))*a)^2)

v = sqrt(1/b)

p = 1/v

Mr= (1+yansima1)/(v*(1-yansima1)*sqrt((1/lamda0)^2-(1/lamdac)^2))
%Mr=1;
Er= (lamda0^2/Mr)*(((1/lamdac)^2)+b);
Er_1= real(Er)
Er_2=imag(Er)

NIST Iterative Method 但我的问题是这张照片。我想在MATLAB中编写“NIST迭代转换方法”。 我写了一部分命令。但我不能写更多。因为我不懂算法。

NIST迭代方法(某些部分)

%%%NIST Iterative Yöntemi
e0 = 8.85*10^-12;
m0 = 4*pi*10^-7;
b=3;
l1 = 1;
l2 =1;
la = l1+l2+l;

w= 2*pi*f;
isik_hizi = 1/sqrt(e0*m0);
Mr = 1;
m=m0*Mr;

y = i*sqrt((((w^2*Mr*(Er_1+i*Er_2))/isik_hizi^2)-(2*pi/lamdac)^2));
y0 = i* sqrt((w/isik_hizi)^2-(2*pi/lamdac)^2);
yansima = ((y0/m0)-(y/m))/((y0/m0)+(y/m));
T = exp(-y*l);
fx =  (s11*s22-s21*s12-(exp(-2*y0)*(la-l))*((T^2)-(yansima^2))/(1-(yansima^2*T^2))) 

请帮帮我。我想用MATLAB写。但我不知道命令。

1 个答案:

答案 0 :(得分:0)

如果你想找到两个根,你可以使用 fslove ,如下所示:

y = @(Er) i*sqrt((((w^2*Mr*(Er))/isik_hizi^2)-(2*pi/lamdac)^2));
y0 = i* sqrt((w/isik_hizi)^2-(2*pi/lamdac)^2);
yansima = @(Er) ((y0/m0)-(y(Er)/m))/((y0/m0)+(y(Er)/m));
T = @(Er) exp(-y(Er)*l);
fx = @(Er) (s11*s22-s21*s12-(exp(-2*y0)*(la-l))*((T(Er)^2)-(yansima(Er)^2))/(1-(yansima(Er)^2*T(Er)^2)))

options = optimset(optimset('fsolve'), 'TolFun', 1.0e-12, 'TolX',1.0e-12);
Er1 = fsolve(fx, x01, options);
Er2 = fsolve(fx, x02, options);

但就像我不知道NIST方法一样,我无法帮助您找到x01x02,但在 fsolve 中会找到最接近{{1}的解决方案(x01 x02) fx(Er1) ~= 0 Er1是最接近x01的解决方案。如果您想在第一部分找到靠近Er的解决方案,您可以使用x01 = real(Er)