2012-10-15 3 views
2

함수에서 matlab 함수를 사용하고 싶습니다.루츠가 함수에서 작동하지 않습니다.

하지만 작동하지 않습니다. 나는 그 문제를 어떻게 풀 수 있을지 전혀 모른다. 여기

는 기능입니다 :

function [ roots , poles ] = pr_calc(num , den) 
%PR_CALC Summary of this function goes here 
% Detailed explanation goes here 


poles=roots([den]); 
roots=roots([num]); 

end 

그리고 이것은 오류 메시지입니다 :

??? At compilation, "roots" was determined to be 
a variable and this 
variable is uninitialized. "roots" is also a 
function name and previous versions of MATLAB 
would have called the function. 
However, MATLAB 7 forbids the use of the same 
name in the same 
context as both a function and a variable. 

Error in ==> pr_calc at 6 
poles=roots([den]); 

답변

4

내가 MATLAB 실제로, 당신이 알아야 할 모든 것을 말하고있다 생각합니다. "roots"라는 변수를 함수의 반환 값으로 정의했지만 "roots"은 이미 함수이므로이므로 동일한 이름을 사용할 수 없습니다. 사용해보기 :

function [ myroots , poles ] = pr_calc(num , den) 
%PR_CALC Summary of this function goes here 
% Detailed explanation goes here 


poles=roots([den]); 
myroots=roots([num]); 

end 
+0

오 마이 갓 !!! 나는 눈이 멀다. 빠른 답변 주셔서 감사합니다. –

관련 문제