Zeros of a complex surface
Afficher commentaires plus anciens
I have a complex matrix Z (evolving in time) and would like to know at which points both the real and the imaginary part of Z are null. I can do it graphically using the following code:
figure
set(gca,'fontsize',16)
for k = 1:size(T)
cla;
contour(HI0,HR0,real(Z{k}),[0,0],'b.')
hold on
contour(HI0,HR0,imag(Z{k}),[0,0],'r.')
hold on
legend(strcat('Re(Z): T=',num2str(T(k))),strcat('Im(Z): T=',num2str(T(k))));
xlabel H_I
ylabel H_R
pause(0.5);
end
which shows the intersections of the isocurves Re(Z)=0 and Im(Z)=0, but I am stuck here. If I take abs(Z), I am afraid not to get all the zeros.
Thanks a lot!
2 commentaires
Michelangelo Ricciulli
le 7 Mar 2017
So you need to separately find where the real part and imaginary part are exactly zero,right?
Matthieu Michel
le 8 Mar 2017
Réponse acceptée
Plus de réponses (1)
wrong approach,
people take abs(Z)==0 to solve the problem mentioned in your question PRECISELY because whem real(Z)==0 && imag(Z)==0 happens when abs(Z)==0 hits the ground, for continuous functions.
Obviously evaluating real and image for the same instant. You are not checking real at t0 and imag at t1 t1~=t2, are you?
Think it this way, the only complex points where you can ignore the angle are those with real and imaginary parts really small, both small at the same time.
That is precisely what abs() measures.
So, if it's about finding out [X Y] that meet
real(Z)==0 && imag(Z)==0
no need to split real and imag, go straight to
abs(Z)==0
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG
4 commentaires
Walter Roberson
le 7 Mar 2017
Right. abs(a+1i*b) for real a and b is defined as sqrt(a^2 + b^2), which can only be 0 if both a and b are 0, so abs(a+1i*b) acts like an "and" test for both a and b being 0.
John BG
le 7 Mar 2017
Precisely, Mr Roberson, no need to split real() imag(), aim at abs() and end problem.
Matthieu Michel
le 8 Mar 2017
John BG
le 8 Mar 2017
Modifié(e) : John Kelly
le 9 Mar 2017
Matthieu
now you have started wondering on the right direction.
Unless you are writing a PhD dissertation about the Complex plane, when the module is null, both Real() and Imag() are null.
With the really close values to zero, would you could do is to use floor() or ceil() or round(), or a combination of them with the right conditional commands.
The point is that you may save time using abs + floor, and it's time you have to write code solving something else.
I wonder if you would be so kind to mark my answer as accepted by clicking on the ACCEPT ANSWER button that only you see.
thanks in advance
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!