Trigonometric approximation on symbolic variables
Show older comments
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
2 Comments
Walter Roberson
on 6 Oct 2019
Is it the case that some of the sin() and cos() arguments will be small but others will not? For example in cos(x1x2x3) should it be assumed that x1*x2*x3 will be "small", or is there the possibility that even though x1 and x2 are "small" that when multiplied by x3 that the result might be large enough to count ? Does it all need to be made conditional, something like
piecewise(x < small & y < small & 0 <= small + x & 0 <= small + y, y - Tp + 1, x < small & 0 <= small + x, sin(y) - Tp + 1, y < small & 0 <= small + y, y - Tp + cos(x), cos(x) - Tp + sin(y))
Here -small < x < small was used for the test on x being small enough for the substitution to be valid, with the case where it is not small preserved.
Aik Ann Seng
on 6 Oct 2019
Edited: Aik Ann Seng
on 6 Oct 2019
Accepted Answer
More Answers (1)
darova
on 5 Oct 2019
subs works ok for me
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} = subs(eqn{i},{'sin(y)' 'sin(x)' 'cos(x)'},{y,x,1})
end
1 Comment
Aik Ann Seng
on 6 Oct 2019
Categories
Find more on Numeric Solvers 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!