How to write an M-file that uses ezplot to display a graph and a circle on the same figure ?

조회 수: 1 (최근 30일)
Write an M-file that use ezplot to display the graph of 2x^2+xy+y^4=1 and the circle x^2+y^2=1, on the same figure.
with graphing window where x and y vary from -1.2 to +1.2. help please

답변 (1개)

Star Strider
Star Strider 2016년 3월 11일
편집: Star Strider 2016년 3월 11일
This is obviously a homework assignment.
  1. Create anonymous functions for both of your functions, perhaps calling them ‘p’ for the polynomial and ‘c’ for the circle,
  2. Plot the polynomial as ‘ezplot(p, [xmin xmax ymin ymax])’ and the same for the circle,
  3. See the documentation for the hold function,
  4. See the documentation for the axis function (so the circle looks like a circle and not an ellipse).
That should give you your plot.
  댓글 수: 2
Kosmas-Damianos Giannakos
Kosmas-Damianos Giannakos 2016년 3월 11일
syms x y;
z=2.*x.^2+x.*y+y.^4-1; d=x.^2+y.^2-1;
ezplot3(z,p,[-1.2 1.2]);
% i did that and keep showing error on the ezplot , am i forgetting something ?
Star Strider
Star Strider 2016년 3월 11일
I can’t make it work with symbolic functions either. That’s the reason I suggested using anonymous functions. I can make it work with them.
I rarely use ezplot (and it’s obsolete starting with R2016a), so I only use it with anonymous functions.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by