![]() |
在MATLAB中绘制隐式代数方程
我希望在MATLAB中绘制隐式函数。像x ^ 3 + xy + y ^ 2 = 36一样,不能将方程变成简单的参数形式。有没有简单的方法?
[B]回答:[/B] 这里有几个选择... [B]使用[URL="https://www.mathworks.com/help/matlab/ref/ezplot.html"]ezplot[/URL] (或在较新版本中建议使用[URL="https://www.mathworks.com/help/matlab/ref/fplot.html"]fplot[/URL] ): [/B] 最简单的解决方案是使用[URL="https://www.mathworks.com/help/matlab/ref/ezplot.html"]ezplot[/URL]函数: ezplot('x.^3 + x.*y + y.^2 - 36', [-10 10 -10 10]); 这给你下面的情节: [URL="https://i.stack.imgur.com/o9gj8.jpg"][IMG]https://i.stack.imgur.com/o9gj8.jpg[/IMG][/URL] [B]使用[URL="https://www.mathworks.com/help/matlab/ref/contour.html"]contour[/URL] : [/B] 另一种选择是生成一组点,您将在其中评估函数f(x,y) = x^3 + x*y + y^2 ,然后使用函数[URL="https://www.mathworks.com/help/matlab/ref/contour.html"]contour[/URL]绘制其中f(x,y)轮廓线等于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 ay label title('x^3 + xy + y^2 = 36'); % Add a title 上面给出的绘图几乎与[URL="https://www.mathworks.com/help/matlab/ref/ezplot.html"]ezplot[/URL]生成的绘图相同: [URL="https://i.stack.imgur.com/oMwtq.jpg"][IMG]https://i.stack.imgur.com/oMwtq.jpg[/IMG][/URL] [url=https://stackoverflow.com/questions/2722500]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 05:06。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.