MATLAB: Trigonometric approximation on symbolic variables

approximationMATLABsymbolictrigonometry

Hi,
I would like to know how to perform or represent trigonometric approximations in Matlab. For example, let's say I have the set of symbolic equations
cos(x) + sin(y) = Tp;
1 + x + sin(x) = Tw;
When making the assumption that x and y are small, I want to transform the equations into the form
1 + y = Tp;
1 + x + x = Tw;
Using the subs function to replace all the sines and cosines does not seem to be feasible when I have many variables.
Thank you

Best Answer

syms x y Tp Tw
eqn(1) = cos(x) + sin(y) - Tp;
eqn(2) = 1 + x + sin(x) - Tw;
for i = 1:2
eqn(i) = mapSymType( mapSymType(eqn(i), 'sin', @(x)children(x)), 'cos', @(x)1 );
end
This requires R2019a or later.