필터 지우기
필터 지우기

How to get simple answer using symbolic functions?

조회 수: 1 (최근 30일)
Muhammad Zeeshan Babar
Muhammad Zeeshan Babar 2017년 2월 4일
댓글: Muhammad Zeeshan Babar 2017년 2월 6일
Hello, I am using syms for computing Lie derivative. My problem is that I have a robot model and when I take the 2nd lie derivative, the matrix appears like
state = [x1; x2 ;x3 ;x4];
fx = 4*1 sym function
hx = hx_new = [1 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0]*state;
Lf0_h_new = hx_new;
b1_new = jacobian(Lf0_h_new, state);
Lf1_h_new = simplify(b1_new*fx);
b2_new = jacobian(Lf1_h_new, state);
Lf2_h_new = simplify(b2_new*fx)
-(17932868243945039509054995298422620160000000000*x1 + 179328622760811041254165969937467169271875000*x2 - 9543444251212304856447901238125480501680537600*x1*cos(x3)^2 - 95434442512123048564479012381254805016805376*x2*cos(x3)^2 + 29067690344163397395312355854778368000000*x4^2*sin(x3) + 2340529702609818139925095463956512768000000*cos(x3)*sin(x3) - 24981799213169175398901578715708984375*x2*cos(x3))/(6773644423866147353395200*(1408908359226399653888*cos(x3)^2 - 2647447536626024609375))
0
0
0]
I dont know why it is appearing like this. Someone please help

채택된 답변

Walter Roberson
Walter Roberson 2017년 2월 4일
Lf2_h_new = simplify(b2_new*fx, 'step', 20)
  댓글 수: 2
Muhammad Zeeshan Babar
Muhammad Zeeshan Babar 2017년 2월 5일
I have changed this but the answer is still the same. Lf2_h_new =
x1 + x2/100 + ((298393196769181919915233795161640625*x2)/33868222119330736766976 - (2197141822764470625*x4^2*sin(x3))/512 + cos(x3)*((37010072908398778368743079578828125*x2)/10035028776097996079104 - (5528556401604393125*sin(x3))/16))/(1408908359226399653888*cos(x3)^2 - 2647447536626024609375)
0
0
0
Walter Roberson
Walter Roberson 2017년 2월 5일
That answer is different than the original Lf2_h_new.
It would help if you were to describe what you were expecting.

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

추가 답변 (1개)

Steven Lord
Steven Lord 2017년 2월 5일
Use vpa to approximate the numbers in the answer to a desired number of decimal places.
  댓글 수: 1
Muhammad Zeeshan Babar
Muhammad Zeeshan Babar 2017년 2월 6일
Thankyou so Much Steven .. It works really well for me.

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

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by