Complex numbers appearing from no where.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi guys,
My formula suppose to plot a parabolic surface
0.666 = sqrt(X^2+ Y^2+ Z^2) - sqrt((X-1)^2+ Y^2+ Z^2))
So i solve for Y using the Matlab solver and then plot it with a meshgrid. At the moment i plot only with the real value.
x = 0.5 : 0.1 : 10; z = -10 : 0.1 : 0; [X,Z] = meshgrid(x,z);
I'm expecting a cone type plot but somehow there this extra plane like thing below.
I tried removing the real(Y) yet nothing is being plotted. But i realize that the plane like thing is actually created due to complex number being taken only the real side thus Y~=0
Can i ask is it because i use meshgrid and it forces values of X and Z into the equation?
I tried doing Y(imag(Y) ~= 0) = NaN; But result is still incomplete.
Help!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152776/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152777/image.png)
댓글 수: 1
Walter Roberson
2013년 10월 31일
What formula are you using for Y ? Are you taking into account that there are two solutions, negatives of each other, so you need to include both of them to get the proper output ?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!