今天,带来关于Matlab极坐标中的最后一篇系列文章,本文讲解绘制极坐标函数图像的方法,所用到的函数为ezpolar。就相当于,给一个极坐标函数,可以用这个ezpolar直接绘制出极坐标图像。我们将分别以常见用法、语法说明、数字函数的极坐标图创建几个方面来讲解该ezpolar函数的用法。

下面,先给出Matlab中关于该ezpolar函数的帮助文档,如下:
>> help ezpolar
ezpolar Easy to use polar coordinate plotter.
ezpolar(FUN) plots the polar curve RHO = FUN(THETA) over the default
domain 0 < theta < 2*pi.
ezpolar(FUN,[A,B]) plots FUN for A < THETA < B.
ezpolar(AX,...) plots into AX instead of GCA.
H = ezpolar(...) returns a handle to the plotted object in H.
Examples
The easiest way to express a function is via a string:
ezpolar('sin(2*t)*cos(3*t)',[0 pi])
One programming technique is to vectorize the string expression using
the array operators .* (TIMES), ./ (RDIVIDE), .\ (LDIVIDE), .^ (POWER).
This makes the algorithm more efficient since it can perform multiple
function evaluations at once.
ezpolar('sin(2*t).*cos(3*t)',[0 pi])
You may also use a function handle to an existing function or an
anonymous function. These are more powerful and efficient than string
expressions.
ezpolar(@cos)
ezpolar(@(t)sin(3*t))
If your function has additional parameters, for example k1,k2 in myfun:
%-------------------------%
function s = myfun(t,k1,k2)
s = sin(k1*t).*cos(k2*t);
%-------------------------%
then you may use an anonymous function to specify the parameters:
ezpolar(@(t)myfun(t,2,3))常见用法
ezpolar(fun) ezpolar(fun,[a,b]) ezpolar(axes_handle,...) h = ezpolar(...)
语法说明
ezpolar(fun) 在默认域 0 < theta < 2π 中绘制极坐标曲线 rho = fun(theta)。
fun 可以是函数句柄、字符向量或字符串。
ezpolar(fun,[a,b]) 绘制 a < theta < b 的 fun。
ezpolar(axes_handle,…) 将图形绘制到带有句柄 axes_handle 的坐标区中,而不是当前坐标区 (gca) 中。
h = ezpolar(…) 将句柄返回给 h 中的线对象。
数字函数的极坐标图创建
在域 [0,2π] 上绘制函数 1+cos(t)。
figure
ezpolar('1+cos(t)')
转载文章,原文出处:MathWorks官网,由古哥整理发布
如若转载,请注明出处:https://iymark.com/articles/1352.html

微信扫一扫
支付宝扫一扫

