如何在 MATLAB 中编写代码?

编程入门 行业动态 更新时间:2024-10-28 07:24:04
本文介绍了如何在 MATLAB 中编写代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我解决了 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 中编写代码?

本文发布于:2023-07-22 10:25:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   如何在   MATLAB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!