我想在MATLAB中得到这个,但是我没有成功!那里有MATLAB大师吗?
alt text http://www.freeimagehosting.net/uploads/94020b921d.gif
我想简单的命令应该可行,可能不需要程序.
错误,我得到的是;
>> t = -pi:0.1:pi;
>> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ;
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Run Code Online (Sandbox Code Playgroud)
UPDATE
即使这样也行不通!
>> t = -pi:0.1:pi;
>> r = ((sin(t).*sqrt(cos(t))).*(sin(t) + (7/5)).^(-1)) - 2*sin(t) + 2 ;
>> plot(r,t)
??? Error using ==> plot
Vectors must be the same lengths.
Run Code Online (Sandbox Code Playgroud)
这是一个有效的解决方案:
t = -pi:0.1:pi;
r = ((sin(t).*sqrt(abs(cos(t))))./(sin(t) + (7/5))) - 2*sin(t) + 2 ;
polar(t,r)
Run Code Online (Sandbox Code Playgroud)
编辑
polar并且ezpolar在剧情的可定制性方面非常有限.如果OP想要重现问题中的图片,他们应该转换为笛卡尔坐标并使用情节,就像这样
t = -pi:0.1:pi;
r = ((sin(t).*sqrt(abs(cos(t))))./(sin(t) + (7/5))) - 2*sin(t) + 2 ;
[x,y] = pol2cart(t,r);
plot(x,y)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5427 次 |
| 最近记录: |