使用轮廓绘制功能 [英] Using contour to plot function

查看:54
本文介绍了使用轮廓绘制功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用轮廓线绘制此函数

I try to use contour to plot this function

3y + y ^ 3-x ^ 3 = 5

3y + y^3 - x^3 = 5

我尝试了轮廓(3 * y + y ^ 3-x ^ 3-5),但是它不起作用.

I try contour(3*y+y^3-x^3-5) but it doesn't work.

如何使用轮廓线绘制此函数?

How can I use contour to plot this function?

推荐答案

x和y是否正确定义为2x2矩阵?如果是这样,则"power"运算符需要在组件的基础上完成(.^ 3而不是^ 3).

Are x and y properly defined as 2x2 matrices? If so then the "power" operator needs to be done on a component-wise basis (.^3 instead of ^3).

这有效:

[x,y] = meshgrid(-2:.2:2,-2:.2:2);
contour(3*y+y.^3-x.^3-5)

这篇关于使用轮廓绘制功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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