how to solve symbolic function exactly?

2 visualizzazioni (ultimi 30 giorni)
yong zhang
yong zhang il 2 Lug 2011
%%% I want to solve these symbolic functions getting a expression of se(i1) =============================================================================== >> eq1='s3*sin(i3)-l1*sin(i1)-a=0'; >> eq2='s3*cos(i3)-l1*cos(i1)=0'; >> eq3='l3*sin(i3)-l4*sin(i4)-b=0'; >> eq4='l3*cos(i3)-l4*cos(i4)-se=0'; >> [se,s3,i3,i4]=solve(eq1,eq2,eq3,eq4) %%% But the result is not my expectation ======================================================================================== se =
(a*cos(i3))/(cos(i1)*sin(i3) - cos(i3)*sin(i1))
%%% I can use eq1 and eq2 to constitute eq0,then I can get the expression of i3(i1)._ ======================================================================================= >> eq0='tan(i3)-(l1*sin(i1)-a)/(l1*cos(i1))';
>> s=solve(eq0,'i3')
s =
-atan(1/l1/cos(i1)*(a - l1*sin(i1))) ========================================================================================%%% a=0.27 l1=0.859 i1[-pi/10:pi/18:1.98pi] so I replaced symbols of the function,but I found the result is not correct,when I compare the result to the answer of my teacher(the figure of se(i1) should be a curve not a straight line ). =============================================================================== >> se=subs(se,'i3',s)
se =
-a/(((a - l1*sin(i1))^2/(l1^2*cos(i1)^2) + 1)^(1/2)*(sin(i1)/((a - l1*sin(i1))^2/(l1^2*cos(i1)^2) + 1)^(1/2) + (a - l1*sin(i1))/(l1*((a - l1*sin(i1))^2/(l1^2*cos(i1)^2) + 1)^(1/2))))
>> simplify(se)
ans =-l1
>> se=subs(se,'a',0.27)
se =
-27/(100*((l1*sin(i1) - 27/100)^2/(l1^2*cos(i1)^2) + 1)^(1/2)*(sin(i1)/((l1*sin(i1) - 27/100)^2/(l1^2*cos(i1)^2) + 1)^(1/2) - (l1*sin(i1) - 27/100)/(l1*((l1*sin(i1) - 27/100)^2/(l1^2*cos(i1)^2) + 1)^(1/2))))
>> se=subs(se,'l1',0.859)
se =
27/(100*((1000*((859*sin(i1))/1000 - 27/100))/(859*((1000000*((859*sin(i1))/1000 - 27/100)^2)/(737881*cos(i1)^2) + 1)^(1/2)) - sin(i1)/((1000000*((859*sin(i1))/1000 - 27/100)^2)/(737881*cos(i1)^2) + 1)^(1/2))*((1000000*((859*sin(i1))/1000 - 27/100)^2)/(737881*cos(i1)^2) + 1)^(1/2))
>> i1=[-pi/10:pi/18:1.9*pi];
>> ezplot(se)

Risposte (1)

Kai Gehrs
Kai Gehrs il 4 Lug 2011
Hi,
I am not sure which result exactly you are expecting to obtain, but it seems you could specify the variables you would like the symbolic solver to solve for.
If you are looking for the values of 'se', 's3', 'i3' and 'i4', then you should tell the solver, because otherwise some variables to solve for will be chosen by a hueritsic that might not meet your expectation in this particular application (see the doc for 'solve' for more details).
Maybe trying
solve(eq1,eq2,eq3,eq4,'se','s3','i3','i4')
gives a more useful result.
Hope this helps and best regards, -- Kai

Community Treasure Hunt

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

Start Hunting!

Translated by