Trigonometric approximation on symbolic variables
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 6 de Oct. de 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
el 6 de Oct. de 2019
Editada: Aik Ann Seng
el 6 de Oct. de 2019
Respuesta aceptada
Más respuestas (1)
darova
el 5 de Oct. de 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 comentario
Aik Ann Seng
el 6 de Oct. de 2019
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!