English 中文(简体)
MATLAB——复杂线/整体
原标题:MATLAB - complex line/path integral

我试图利用综合指挥在几个循环封闭道路上找到复杂的线/构件。 我关于第1/(z-i)^2圈子({z : > ><2}穿透器)的代码一度为:

fun = @(z) 1 ./((z-1i) .^ 2);;
g = @(t) 2 .*(cos(t) + 1i .* sin(t));
gprime = @(t) 2 .*(-sin(t) + 1i .* cos(t));
q1 = integral(@(t) fun(g(t)) .* gprime(t),0,2 .* pi)

(我预计答案为0,matlab提供6.6613*10^(-16)-4.4409*10^(-16)i)。

My code for the integral of e^z/(z(z^2-9)) over the circle {z:|z-2|=3} traversed once anticlockwise is as follows:

fun = @(z) exp(z) ./(z .* (z.^2-9));
g = @(t) 2+3 .*(cos(t) + 1i .* sin(t));
gprime = @(t) 2+3 .*(-sin(t) + 1i .* cos(t));
q1 = integral(@(t) fun(g(t)) .* gprime(t),0,2 .* pi)

(我预计答案为pi/9(e^3-2)i,但书记处提供5.431+6.3130i)。

As can be seen above, my problem is that while the code gives accurate values when the circular path is centred at the origin, it fails otherwise; sometimes giving an accurate imaginary part but inaccurate real part or just a completely inaccurate answer.

Can anyone see what is going wrong?

最佳回答

我在评论中回答了第一个问题。

关于第二个问题,你在计算衍生工具时犯了一个错误:重复不变2应当消失。 这样,你将获得6.3130,完全符合理论价值。

fun = @(z) exp(z) ./(z .* (z.^2-9));
g = @(t) 2+3 .*(cos(t) + 1i .* sin(t));
gprime = @(t) 3 .*(-sin(t) + 1i .* cos(t));
q1 = integral(@(t) fun(g(t)) .* gprime(t),0,2 .* pi)

I take the opportunity to advise you, instead of the previous method, to compute complex integrals by "way points" method (see for example https://uk.mathworks.com/help/matlab/math/complex-line-integrals.html) ; here, it would be

C=[-2+i,-2-i,5-i,5+i];
integral(@(z) (exp(z) ./(z .* (z.^2-9))),1,1, WayPoints ,C)

如果C是一平方(更概括地说是一平方),则只包含所希望的极地。 (途径2和3参数为1,1)

附录:按残余物对理论价值的快速个人检查:

2i pi(Res(f,0)+Res(f,3)=2i pi(1/(-9)+e^3/(27-9))。

问题回答

您对第二个问题的回答是不正确的。 数学告诉我,答案应当是:

pi*(2/45)*(5 + (exp(2))*(5*exp(1) - 9)) + (pi/9 *(exp(3) - 2))*i

= 5.435120011473026 + 6.313043326012592i

这几乎是你从马特拉布获得的答案。

请注意,Matlab的integral功能履行全数>集成,因此,你获得的结果将出现机对冲错。 这意味着,你对第一个问题的结果基本上也是正确的;这或许是你在数字融合方面的最佳答案。





相关问题
MATLAB Solving equations problem

I want to solve these equations using MATLAB and I am sure there is a non zero solution. The equations are: 0.7071*x + 0.7071*z = x -0.5*x + 0.7071*y + 0.5*z = y -0.5*x - 0.7071*y +...

Difference between MATLAB s matrix notations

How do you read the following MATLAB codes? #1 K>> [p,d]=eig(A) // Not sure about the syntax. p = 0.5257 -0.8507 -0.8507 -0.5257 d = ...

preventing data from being freed when vector goes out of scope

Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes ...

Divide two polynomials using MATLAB

I want to divide p(x) by q(x) given that: p(x)=-5x^4+3x^2-6x q(x)=x^2+1 I tried: p=inline( -5*(x^4)+3*(x^2) , x ) p = Inline function: p(x) = -5*(x^4)+3*(x^2) q=inline( x^2+1 , x ) q = ...

matlab deals with Fibbonacci

The Fibonacci series is given as follows: 1, 2, 3, 5, 8, 13, 21, ... How can I write a script which calculates and prints the n-th Fibonacci term (for n>2), where n is inputed by the user. This ...

How do I plot lines between all points in a vector?

I have a vector containing some points in 2-D space. I want MATLAB to plot these points with lines drawn from every point to every other point. Basically, I want a graph with all vertices connected. ...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen( c:\out.txt , wt ); %write something to the file fclose(fid); end I want data to be written to different files like ...

热门标签