在MATLAB中绘制隐式代数方程 [英] Plotting Implicit Algebraic equations in MATLAB

查看:144
本文介绍了在MATLAB中绘制隐式代数方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在MATLAB中绘制隐式函数.像x ^ 3 + xy + y ^ 2 = 36一样,不能将方程变成简单的参数形式.有没有简单的方法?

I wish to plot implicit functions in MATLAB. Like x^3 + xy + y^2 = 36 , equations which cannot be made into simple parametric form. Is there any simple method ?

推荐答案

以下是几个选项...

Here are a couple of options...

最简单的解决方案是使用功能 ezplot :

The easiest solution is to use the function ezplot:

ezplot('x.^3 + x.*y + y.^2 - 36', [-10 10 -10 10]);

哪位给你以下情节:


另一种选择是生成一组要评估函数f(x,y) = x^3 + x*y + y^2的点,然后使用函数

Another option is to generate a set of points where you will evaluate the function f(x,y) = x^3 + x*y + y^2 and then use the function contour to plot contour lines where f(x,y) is equal to 36:

[x, y] = meshgrid(-10:0.1:10);   % Create a mesh of x and y points
f = x.^3+x.*y+y.^2;              % Evaluate f at those points
contour(x, y, f, [36 36], 'b');  % Generate the contour plot
xlabel('x');                     % Add an x label
ylabel('y');                     % Add a y label
title('x^3 + x y + y^2 = 36');   % Add a title

以上内容将为您提供与 ezplot :

The above will give you a plot nearly identical to the one generated by ezplot:

这篇关于在MATLAB中绘制隐式代数方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆