???Error using feval Undefined function 'pfpower' for input arguments of type 'double'.???

조회 수: 1 (최근 30일)
Hi everybody
I was trying to understand previous answers to similar questions as mine indcated in Question subject above, but I didn't get it.
I'm using Matlab R2012a and I'm trying to run the function below from Hadi Saadat textbook, but the first error that I get is:
Error using feval Undefined function 'pfpower' for input arguments of type 'double'.
Could you please give me any hint ? it's because the function was developed in another Matlab version.
Thanks in advance for your help
<<function-nbsp--nbsp-Cctime-Pm--nbsp-E--nbsp-V--nbsp-X1--nbsp-X2--nbsp-X3--nbsp-H--nbsp-f--n-nbsp--nbsp-Pe1max-nbsp---nbsp-E-V-X1--nbsp-Pe2max-E-V-X2--nbsp-Pe3max-E-V-X3--n-nbsp--nbsp-d0-nbsp--asin-Pm-Pe1max---n-nbsp--nbsp-dmax-nbsp---nbsp-pi-asin-Pm-Pe3max---n-nbsp--nbsp-cosdc-nbsp---nbsp--Pm--dmax-d0--Pe3max-cos-dmax--Pe2max-cos-d0----Pe3max-Pe2max---n-nbsp--nbsp--nbsp--nbsp-if-nbsp-abs-cosdc--nbsp--gt--nbsp-1-n-nbsp--nbsp--nbsp--nbsp-fprintf--No-nbsp-critical-nbsp-clearing-nbsp-angle-nbsp-could-nbsp-be-nbsp-found---n---n-nbsp--nbsp--nbsp--nbsp-fprintf--System-nbsp-can-nbsp-remain-nbsp-stable-nbsp-during-nbsp-this-nbsp-disturbance---n--n---n-nbsp--nbsp--nbsp--nbsp-return-n-nbsp--nbsp--nbsp--nbsp-else--nbsp-end-n-nbsp--nbsp-dc-nbsp---nbsp-acos-cosdc---n-nbsp--nbsp--nbsp--nbsp-if-nbsp-dc-nbsp--gt--nbsp-dmax-n-nbsp--nbsp--nbsp--nbsp-fprintf--No-nbsp-critical-nbsp-clearing-nbsp-angle-nbsp-could-nbsp-be-nbsp-found---n---n-nbsp--nbsp--nbsp--nbsp-fprintf--System-nbsp-can-nbsp-remain-nbsp-stable-nbsp-during-nbsp-this-nbsp-disturbance---n--n---n-nbsp--nbsp--nbsp--nbsp-return-n-nbsp--nbsp--nbsp--nbsp-else--nbsp-end-n-nbsp--nbsp-tf-nbsp---nbsp-0-4--n-nbsp--nbsp-x0-nbsp---nbsp--d0--nbsp-0---n-nbsp--nbsp---t1-xf--nbsp--ode23--pfpower---nbsp-0--nbsp-tf--nbsp-x0--nbsp-0-00001---nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-4-n-nbsp--nbsp-tspan-nbsp---nbsp--0--nbsp-tf---nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp-options-nbsp---nbsp-odeset--RelTol---nbsp-0-00001---nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp--t1-xf--nbsp--ode23--pfpower---nbsp-tspan--nbsp-x0--nbsp-options---nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp-kk-find-xf---1--nbsp--lt---nbsp-dc---nbsp-k-max-kk---n-nbsp--nbsp-tt-t1-k---n-nbsp--nbsp-while-nbsp-tf-nbsp--lt---nbsp-tt-nbsp---nbsp-tf-nbsp--lt---nbsp-3-6-n-nbsp--nbsp-tf-tf--4--n-nbsp--nbsp--nbsp--nbsp--nbsp-fprintf----nSearching-nbsp-with-nbsp-a-nbsp-final-nbsp-time-nbsp-of-nbsp--3-2f-nbsp-Sec--nbsp---n---nbsp-tf--n-nbsp--nbsp--nbsp--nbsp--nbsp-tol-0-00001-tf-2-5e-5--n-nbsp--nbsp--nbsp--nbsp--nbsp---t1-xf--nbsp--ode23--pfpower---nbsp-0--nbsp-tf--nbsp-x0--nbsp-tol---nbsp--nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-4-n-nbsp--nbsp--nbsp--nbsp--nbsp-tspan-nbsp---nbsp--0--nbsp-tf---nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp--nbsp--nbsp--nbsp-options-nbsp---nbsp-odeset--RelTol---nbsp-tol---nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp--nbsp--nbsp--nbsp--t1-xf--nbsp--ode23--pfpower---nbsp-tspan--nbsp-x0--nbsp-options---nbsp--nbsp---nbsp-use-nbsp-with-nbsp-MATLAB-nbsp-5-n-nbsp--nbsp--nbsp--nbsp--nbsp-kk-find-xf---1--nbsp--lt---nbsp-dc---nbsp-k-max-kk---n-nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp--nbsp-tt--nbsp-t1-k---n-nbsp--nbsp-end-n-nbsp--nbsp--end-n-nbsp--nbsp-tmargin-nbsp---nbsp-t1-k---n-nbsp--nbsp-if-nbsp-tf-nbsp--gt---nbsp-3-6-n-nbsp--nbsp--nbsp--nbsp-fprintf----nA-nbsp-clearing-nbsp-time-nbsp-could-nbsp-not-nbsp-be-nbsp-found-nbsp-up-nbsp-to-nbsp-4-nbsp-sec--nbsp---n--n---n-nbsp--nbsp--nbsp--nbsp-return-n-nbsp--nbsp--nbsp--nbsp-else--nbsp-end-n-nbsp--nbsp-fprintf----nCritical-nbsp-clearing-nbsp-time-nbsp---nbsp--nbsp--4-2f-nbsp-seconds-nbsp---n---nbsp-tmargin--n-nbsp--nbsp-fprintf--Critical-nbsp-clearing-nbsp-angle-nbsp---nbsp--6-2f-nbsp-degrees-nbsp---n--n---nbsp-dc-180-pi.>>
  댓글 수: 2
Claudia
Claudia 2013년 5월 13일
편집: Claudia 2013년 5월 13일
Sorry, I forgot to include the function..
function Cctime(Pm, E, V, X1, X2, X3, H, f)
Pe1max = E*V/X1; Pe2max=E*V/X2; Pe3max=E*V/X3;
d0 =asin(Pm/Pe1max);
dmax = pi-asin(Pm/Pe3max);
cosdc = (Pm*(dmax-d0)+Pe3max*cos(dmax)-Pe2max*cos(d0))/(Pe3max-Pe2max);
if abs(cosdc) > 1
fprintf('No critical clearing angle could be found.\n')
fprintf('System can remain stable during this disturbance.\n\n')
return
else, end
dc = acos(cosdc);
if dc > dmax
fprintf('No critical clearing angle could be found.\n')
fprintf('System can remain stable during this disturbance.\n\n')
return
else, end
tf = 0.4;
x0 = [d0; 0];
%[t1,xf] =ode23('pfpower', 0, tf, x0, 0.00001); % use with MATLAB 4
tspan = [0, tf]; % use with MATLAB 5
options = odeset('RelTol', 0.00001); % use with MATLAB 5
[t1,xf] =ode23('pfpower', tspan, x0, options); % use with MATLAB 5
kk=find(xf(:,1) <= dc); k=max(kk);
tt=t1(k);
while tf <= tt & tf <= 3.6
tf=tf+.4;
fprintf('\nSearching with a final time of %3.2f Sec. \n', tf)
tol=0.00001+tf*2.5e-5;
%[t1,xf] =ode23('pfpower', 0, tf, x0, tol); % use with MATLAB 4
tspan = [0, tf]; % use with MATLAB 5
options = odeset('RelTol', tol); % use with MATLAB 5
[t1,xf] =ode23('pfpower', tspan, x0, options); % use with MATLAB 5
kk=find(xf(:,1) <= dc); k=max(kk);
tt= t1(k);
end
%end
tmargin = t1(k);
if tf >= 3.6
fprintf('\nA clearing time could not be found up to 4 sec. \n\n')
return
else, end
fprintf('\nCritical clearing time = %4.2f seconds \n', tmargin)
fprintf('Critical clearing angle = %6.2f degrees \n\n', dc*180/pi)
David Sanchez
David Sanchez 2013년 5월 13일
could you please insert your function as such? ( use the {}Code option ) It is not easy to follow what's a comment and what's code.

댓글을 달려면 로그인하십시오.

답변 (1개)

Yao Li
Yao Li 2013년 5월 13일
It's Ok, if the fucntion is written in the earlier version. Pls. make sure the script (m file) which defines the function is in current folder or has been added to Matlab path.
  댓글 수: 3
Yao Li
Yao Li 2013년 5월 13일
Is the script for the function pfpower in current folder? Would u pls. insert the function pfpower as well?
Claudia
Claudia 2013년 5월 13일
The function pfpower is now in current folder but three new error messages apears; one of them:
Error in Cctime (line 27) [t1,xf] =ode23('Pfpower', tspan, x0, options); % use with MATLAB 5

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by