MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]一个函数的引用问题 (https://www.labfans.com/bbs/showthread.php?t=2401)

happyluokun 2008-04-18 23:29

[求助]一个函数的引用问题
 
我编了一个求解椭圆极径的程序
function r(x)
a=0.8;
b=0.6;
r=sqrt(a^2*b^2/(b^2*cos(x)^2+a^2*sin(x)^2))
在引用这个函数的时候
r(2*pi)

r =

0.8000
但是

>> c=r(2*pi)*r(2*pi)
??? Error using ==> r
Too many output arguments.
或者
c=r(2*pi)
??? Error using ==> r
Too many output arguments
我的目的是求解矢径的二次方,请问哪里出错了
再线等

fgabertb 2008-04-19 03:43

r又當函數名稱 又當變數名稱 影響到了
把函數名稱換掉看看~:smile:

happyluokun 2008-04-19 12:04

[QUOTE=fgabertb;8934]r又當函數名稱 又當變數名稱 影響到了
把函數名稱換掉看看~:smile:[/QUOTE]

试过了,还是不得

fgabertb 2008-04-19 13:30

function r=abc(x) %指定輸出是r
a=0.8;
b=0.6;
r=sqrt(a^2*b^2/(b^2*cos(x)^2+a^2*sin(x)^2)); %加分號


===========

>> c=abc(2*pi).*abc(2*pi)

c =

0.6400

試試看吧

happyluokun 2008-04-19 14:42

谢谢,问题解决了


所有时间均为北京时间。现在的时间是 13:15

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.