fsurf not drawing cant explain
3 ビュー (過去 30 日間)
古いコメントを表示
Try these script below
clear
syms x y z;
f1= 0.594693*x - 0.037385*y - 4.415084e-48*(1.410081e94*x^2 - 1.010367e94*x*y - 7.167399e96*x - 6.594237e94*y^2 + 4.505749e95*y + 8.942503e98)^(1/2) - 26.520424;
f2= 0.594693*x - 0.037385*y + 4.415084e-48*(1.410081e94*x^2 - 1.010367e94*x*y - 7.167399e96*x - 6.594237e94*y^2 + 4.505749e95*y + 8.942503e98)^(1/2) - 26.520424;
fsurf(f1,'FaceColor','red')
hold on
fsurf(f2,'FaceColor','green')
hold off
xlabel('x');
ylabel('y');
zlabel('z');
It produce empty drawing.there are some big numbers in the equation but the final value should be within +-200.No reason it doesn't draw.
0 件のコメント
回答 (1 件)
David Wilson
2019 年 4 月 29 日
編集済み: David Wilson
2019 年 4 月 29 日
Do you really need to use the symbolic toolbox? Why not just plot a numerical surface? But you are right, your numbers are widely varying and your surfaces are fairly flat.
Below I just took arbitrary ranges.
clear
f1= @(x,y) 0.594693*x - 0.037385*y - 4.415084e-48*(1.410081e94*x.^2 - 1.010367e94*x.*y - 7.167399e96*x - ...
6.594237e94*y.^2 + 4.505749e95*y + 8.942503e98).^(1/2) - 26.520424;
f2= @(x,y) 0.594693*x - 0.037385*y + 4.415084e-48*(1.410081e94*x.^2 - 1.010367e94*x.*y - 7.167399e96*x - ...
6.594237e94*y.^2 + 4.505749e95*y + 8.942503e98).^(1/2) - 26.520424;
xv = linspace(-2,2,20)'; yv = linspace(-3,5,30)';
[X,Y] = meshgrid(xv,yv)
F1 = f1(X,Y);
F2 = f2(X,Y);
surf(xv, yv, F1)
hold on
surf(xv, yv, F2)
hold off
2 件のコメント
David Wilson
2019 年 4 月 30 日
One ugly solution is to identify where the complex regions are and then "NaN" them.
It's not overly pretty this way, but can be made better with a finer grid. You could always try fimplicit3 if not satisfied.
clear
f1= @(x,y) 0.594693*x - 0.037385*y - 4.415084e-48*(1.410081e94*x.^2 - 1.010367e94*x.*y - 7.167399e96*x - ...
6.594237e94*y.^2 + 4.505749e95*y + 8.942503e98).^(1/2) - 26.520424;
f2= @(x,y) 0.594693*x - 0.037385*y + 4.415084e-48*(1.410081e94*x.^2 - 1.010367e94*x.*y - 7.167399e96*x - ...
6.594237e94*y.^2 + 4.505749e95*y + 8.942503e98).^(1/2) - 26.520424;
% Now use a wide range
yv = linspace(-300,400,150)';
xv = linspace(-300,-120,130)';
[X,Y] = meshgrid(xv,yv)
F1 = f1(X,Y);
F2 = f2(X,Y);
F1(find(imag(F1)~=0)) = NaN; % drop complex parts
F2(find(imag(F2)~=0)) = NaN;
%
surf(xv, yv, real(F1))
hold on
surf(xv, yv, real(F2))
hold off
shading interp
lighting phong
camlight left
![tmp.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/217225/tmp.png)
参考
カテゴリ
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!