问题描述
我解决了 NRW(Nicholson-Ross-Weir Conversion Method) 转换方法,我找到了 epsilonr(Er).
I solved NRW(Nicholson-Ross-Weir Conversion Method) conversion method and I found 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)
但我的问题是这张照片.我想在 MATLAB 中编写NIST 迭代转换方法".我写了部分命令.但我不能再写了.因为我不懂算法.
But my problem this pictures. I want to write "NIST Iterative Conversion Method" in MATLAB.I wrote part of the command. But I couldn't write more. Because I don't understand the algorithm.
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 编写代码.但我不知道命令.
Please help me. I want to write in MATLAB. But I don't know command.
推荐答案
如果你想找到两个根,你可以使用 fslove 如下:
If you want find two roots you could use fslove as below:
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 方法一样,我无法帮助您找到 x01
和 x02
但在 fsolve 中会找到当 fx(Er1) ~= 0
其中 Er1
是最接近的解决方案时,最接近 x01
(或 x02)
的解决方案到 x01
.如果您希望在第一部分找到接近 Er
的解决方案,您可以使用 x01 = real(Er)
.
But like i don't know the NIST method I can't help you finding x01
and x02
but in fsolve will find the closest solution to x01
(or x02)
when fx(Er1) ~= 0
where Er1
is the closest solution to x01
. If you want a solution close to your Er
find in your first part, you can use x01 = real(Er)
.
这篇关于如何在 MATLAB 中编写代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!