residue complex number by matlab

Respuestas (1)

John D'Errico
John D'Errico el 13 de Mzo. de 2015
I can't recall if I ever published this tool. I thought I did.
fun = @(z) (z+1)./(z.^3.*(z-2));
format long g
We know z=2 to be a first order pole.
[res,err] = residueEst(fun,2,'poleorder',1)
res =
0.375
err =
8.8624722305483e-16
And z=0 is a 3rd order pole.
[res,err] = residueEst(fun,0,'poleorder',3)
res =
-0.187500006276744
err =
2.93992309142077e-09
Expect a wee bit less accuracy around higher order poles, but it still did reasonably well.
As I said, I thought it was posted on the File Exchange, but it may not have been. I've written so many neat toys over the years, that sometimes I forget to post them...
As it turns out, I never did post it. I'll update the limest submission to include residueEst, as they are both limit calculators.

8 comentarios

adrian zizo
adrian zizo el 13 de Mzo. de 2015
it doesn't worke .. my matlab version is R2010a
John D'Errico
John D'Errico el 13 de Mzo. de 2015
I've just posted residueEst as a part of my LIMEST File Exchange submission. It includes demos of use.
John D'Errico
John D'Errico el 13 de Mzo. de 2015
I wrote it in 2008, and it has not changed since then. It WILL work. But you need to download it from the file exchange. That tool is not part of MATLAB. You cannot hope it will work unless you get the file.
adrian zizo
adrian zizo el 14 de Mzo. de 2015
I have another problem Mr.John D'Errico .. how can I found the value of complex contour integral : example ∮z/((z^2+4)(z-1)) dz around z-2=2 (center of circle is 2 and radius equal 2)
I answer it by using matlab but it give me error ...
this is my answer :
>> fun=@(z) (z)./((z.^2+4)*(z-1));
>> g=@(theta) (2+2*cos(theta))+2i*sin(theta);
>> gprime=@(theta)-2*sin(theta)+2i*cos(theta);
>> q1=quad(@(t) fun(g(t)).*gprime(t),0,2*pi)
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> @(z)(z)./((z.^2+4)*(z-1))
Error in ==> @(t)fun(g(t)).*gprime(t)
Error in ==> quad at 77
y = f(x, varargin{:});
Ok, so you know how to use .^ and ./ to solve some problems. But is there a reason why you did not use .* also?
fun=@(z) (z)./((z.^2+4)*(z-1)); % your function
fun=@(z) (z)./((z.^2+4).*(z-1)); % my version
See that the error came from mtimes.
Mike Hosea
Mike Hosea el 16 de Mzo. de 2015
FYI, in case it comes in handy at some point, the INTEGRAL function (and QUADGK) can do contour integrals over piecewise linear paths in the complex plane using the 'Waypoints' option. For example, integrating over square path enclosing z = 2
>> integral(f,1,1,'waypoints',[1-1i,3-1i,3+1i,1+1i])
ans =
0 + 2.35619449019235i
>> ans/(2*pi*1i)
ans =
0.375
John D'Errico
John D'Errico el 16 de Mzo. de 2015
That is good to know. Too often these tools contain nice additional abilities that we old-timers never realize were added.
Niklas Kurz
Niklas Kurz el 15 de Jul. de 2021
Editada: Niklas Kurz el 15 de Jul. de 2021
what if there is an indetermined variable in the function? (fun = @(z,a)). Can it deal with two parameters?

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 13 de Mzo. de 2015

Editada:

el 15 de Jul. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by