![]() |
为什么有效的查找语句会在MATLAB中给出错误?
就是这个[URL="https://stackoverflow.com/questions/2720180/matlab-heart-curve"]问题[/URL]銆/ p> 为什么这两个解决方案不起作用,尽管对我来说看起来很有效:
>> 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. >> 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. 上面有什么问题? [B]回答:[/B] *运算符是矩阵乘法运算符,它要求其操作数具有匹配的内部矩阵维。 .*运算符是逐元素的乘法运算符,它要求其操作数具有相同的大小(或一个为标量),以便可以对每个匹配的元素对执行乘法。有关更多详细信息,请参[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/arithmeticoperators.html"]见此链接[/URL] 。 另外,当我运行第二个解决方案时,我没有得到绘制错误。我刚收到以下警告: Warning: Imaginary parts of complex X and/or Y arguments ignored [url=https://stackoverflow.com/questions/2768133]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:04。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.