フィルターのクリア

Converting 2 symbolic expressions into a function handle

1 回表示 (過去 30 日間)
kalpana
kalpana 2013 年 8 月 13 日
I have to solve 2 symbolic expressions num1 = 0 & num2 = 0.
For this , i have given the code like the following ::
syms p q ;
num1 = 3* p^3 + 4*p*q + 5* p^2 + 1; num2 = 4* p^5 + 9*p^3*q + 2* p*q^2 + 2;
fh = matlabFunction(num1, num2)
[x] = fsolve( fh, [1,2] )
When i execute this code, i am getting the following error .
" ??? Input argument "q" is undefined.
Error in ==>
sym.matlabFunction>makeFhandle/@(p,q)deal (p.*q.*4.0+p.^2.*5.0+p.^3.*3.0+1.0,p.*q.^2.*2.0+p.^3.*q.*9.0+p.^5.*4.0+2.0)
Error in ==> fsolve at 248
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. "
I tried a lot to rectify this error. But, could not get any thing. Please help me if anyone knows how to solve this problem.
Thanks in advance.
--Kalpana

採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 8 月 13 日
syms p q;
num1 = 3* p^3 + 4*p*q + 5* p^2 + 1;
num2 = 4* p^5 + 9*p^3*q + 2* p*q^2 + 2;
f = matlabFunction([num1;num2],'vars',{[p,q]});
out = fsolve(f,[1,2]);
  1 件のコメント
kalpana
kalpana 2013 年 8 月 13 日
Thank you very much 'Andrei Bobrov' for your answer. I executed the code which you have given. It is working.
Again, Thanks a lot to you. ---Kalpana

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by