Can not get exact exppresion due to cos function using Matlab symbolic toolbox
Show older comments
hello,
I am currently using Matlab to inplemente a groupe of function which is showing in the next picture.
briefly, this is a conditional expression with two variable,
, repectively.

The objective is generate is expression assuming that σand T are time depending variable then drivate the expression to get the ODE form expression.
here is my code, i found an odd thing that the signal due to the term in expression 'g13(t)' rests always postive, even i'd well defined as a negative term.
syms xi_S0 sigma_crs sigma_crf xi_T0 C_M C_A M_s M_f A_s A_f Delta
syms g11(t) g12(t) g13(t) g14(t) T(t) sigma(t) a_A
%a_A=pi/(A_f-A_s);
a_M=pi/(M_s-M_f);
%Delta= (1-xi_T0-xi_S0)/2 * cos(a_M*(T-M_f)) + (1 + xi_T0 - xi_S0)/2
%case 1
g11(t) =xi_T0/(1-xi_S0) + (1-(xi_T0+xi_S0))/(1-xi_S0) * ((1-xi_S0) /2 * cos(pi/(sigma_crs-sigma_crf) * (sigma(t)-sigma_crf-C_M * (T(t) - M_s))) + (1+xi_S0)/2)
%case 2
g12(t) = (2*xi_S0 -1) / (xi_S0-1) * Delta + (xi_S0-1 - Delta)/(xi_S0-1) * ((1-xi_S0)/2 * cos(pi/(sigma_crs-sigma_crf)*(sigma(t)-sigma_crf)+(1+xi_S0)/2))
%case 3
g13(t) = (xi_S0)/2 * (cos( a_A * ( T(t) - A_s - sigma(t)/C_A))+1)
the results is like this
>> g11
g11(t) =
((xi_S0 + xi_T0 - 1)*(xi_S0/2 - cos((pi*(sigma(t) - sigma_crf + C_M*(M_s - T(t))))/(sigma_crf - sigma_crs))*(xi_S0/2 - 1/2) + 1/2))/(xi_S0 - 1) - xi_T0/(xi_S0 - 1)
>> g12
g12(t) =
(Delta*(2*xi_S0 - 1))/(xi_S0 - 1) + (cos(xi_S0/2 + (pi*(sigma_crf - sigma(t)))/(sigma_crf - sigma_crs) + 1/2)*(xi_S0/2 - 1/2)*(Delta - xi_S0 + 1))/(xi_S0 - 1)
>> g13
g13(t) =
(xi_S0*(cos(a_A*(A_s - T(t) + sigma(t)/C_A)) + 1))/2 %the signal is changed
I'd like to ask if anyone know how to resolve this problem.
Best Rgds,
Kj Hu
Accepted Answer
More Answers (0)
Categories
Find more on Special Values 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!