Converting 2 symbolic expressions into a function handle
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 13 Aug. 2013
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]);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!