![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/370096/image.png)
using fimplicit function to plot
2 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to make a plot using the fimplicit function but the figure is empty.
zf(1) = figure(1);
za(1) = axes;
c = -4:2:4;
fimplicit(@(x,y) y.^2 - x.^2- c);
0 件のコメント
採用された回答
Ameer Hamza
2020 年 10 月 2 日
For a single graph, c must be a scalar. If you want to plot the graph for all values in c, you can use for-loop or arrayfun() (kind of implicit for-loop)
zf(1) = figure(1);
za(1) = axes;
hold(za(1))
C = -4:2:4;
arrayfun(@(c) fimplicit(@(x,y) y.^2 - x.^2 - c), C);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/370096/image.png)
2 件のコメント
Ameer Hamza
2020 年 10 月 2 日
Move figure() and axes() out of for loop
zf(1) = figure(1);
za(1) = axes;
hold(za(1));
for c=-4:2:4
fimplicit(@(x,y) y.^2 - x.^2- c);
end
その他の回答 (1 件)
John D'Errico
2020 年 10 月 2 日
編集済み: John D'Errico
2020 年 10 月 2 日
As an alternative to the use of fimplicit, you can simply think of this as a contour plot. That is essentially all fimplicit does.
c = -4:2:4;
fxy = @(x,y) x.^2 - y.^2;
H = fcontour(fxy,[-5,5, -5,5],'LevelList',c);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/370132/image.jpeg)
Either way works. A contour plot has the virtue that you can create all level lines in one call and no need to loop.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!