Symbolic coding calculations problem.
Show older comments
I wrote my code in matlab using symbolic coding and computed the value of symbolic variable T1 in terms of other symbolic variables and then substituted value of other variables to get this humongous term
(83718240305934237709*sin((459*sin(317/100))/100 + (1901*sin(389/200))/500 + (81*sin(399/200))/40 - (1532*sin(2229/1000))/5 + (1107*sin(2289/1000))/1000 + (1684*sin(1397/2000))/5 + (1211*sin(2507/1000))/2500 - (1822*sin(3837...
.....What should i do to simplify this term into a single term for each entry in array.
relevant segment of Code:
L=L1+L2+L3+L4
del_l_q1x=diff(L,q1x)
del_l_q1=diff(L,q1)
format short
T1=diff(del_l_q1x,q1)*q1x+diff(del_l_q1x,q2)*q2x+diff(del_l_q1x,q4)*q4x+diff(del_l_q1x,q1x)*q1xx+diff(del_l_q1x,q2x)*q2xx+diff(del_l_q1x,q4x)*q4xx-del_l_q1
[q1a,q1xa,q1xxa,q2a,q2xa,q2xxa,q4a,q4xa,q4xxa]=data();
%the function data returns the value corresponding to each function parameter(q1a,q1xa...etc)
for c=1:1:120
T1(c)=subs(T1,[q1,q1x,q1xx,q2,q2x,q2xx,q4,q4x,q4xx],[q1a(c),q1xa(c),q1xxa(c),q2a(c),q2xa(c),q2xxa(c),q4a(c),q4xa(c),q4xxa(c)])
%substituting the values of variables by actual numerics
%T1 is an array of size 120 storing different values .
end
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!