variable q and y

조회 수: 4 (최근 30일)
SHARAD KUMAR UPADHYAY
SHARAD KUMAR UPADHYAY 2019년 2월 14일
댓글: SHARAD KUMAR UPADHYAY 2019년 2월 15일
%%i am using this
fun=@(x) exp(-x)*y
A=GLGD_int(fun,0,1,5)
vpa(A,3)
fun1= matlabFunction(A,'vars', [y]);
B=GLGD_int(fun1,2,5,5)
vpa(B,3)
%% GLGD_int is call by another .m file
%% this program is okay, but as I use the function of the form as "fun=@(x) exp(-x)*y*sin(q)" as
fun=@(x) exp(-x)*y*sin(q)
A=GLGD_int(fun,0,1,5)
vpa(A,3)
fun1= matlabFunction(A,'vars', [y]);
B=GLGD_int(fun1,2,5,5)
vpa(B,3)
%% then error come as
%%Error using sym/matlabFunction>checkVarsSubset (line 207)
%%The free variable q must be included in the 'vars' value.
%%Error in sym/matlabFunction>checkVars (line 195)
%%checkVarsSubset(vexpanded,funvars);
%%Error in sym/matlabFunction (line 137)
%%vars = checkVars(funvars,opts);
%%Error in chi2 (line 8)
%%fun1= matlabFunction(A,'vars', [y]);
  댓글 수: 2
madhan ravi
madhan ravi 2019년 2월 14일
"%% GLGD_int is call by another .m file "
upload it
SHARAD KUMAR UPADHYAY
SHARAD KUMAR UPADHYAY 2019년 2월 15일
Not satisfied by this answer as I wants to take that in same file. Because as i dont use q variable in program then file is run succesfully but as i introduced q then i have error.

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 2월 15일
you cannot do that . When q does not have a specific value then you cannot do numeric integration .
I suggest you search the matlab help for information about parameterizing functions .
  댓글 수: 1
SHARAD KUMAR UPADHYAY
SHARAD KUMAR UPADHYAY 2019년 2월 15일
Fine, to call by another file is okay. I have tried and that works.

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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by