# Finding the magnitude of an expression

2 visualizaciones (últimos 30 días)
Aleem Andrew el 9 de Feb. de 2021
Respondida: David Hill el 9 de Feb. de 2021
Supposing that x can be expressed as a function of t as follows how can its magnitude be found using Matlab? For example, is there some way to simplify the expression as for example A*cos(wt+b) + B * exp(-0.25t)*sin(wt+c) so the magnitude would be sqrt(A^2+B^2) if this were possible?
syms t
x = 0.113*sin(3.0*t) - 0.125*cos(3.0*t) + 0.125*exp(-0.25*t)*cos(3.15*t) - 0.0977*exp(-0.25*t)*sin(3.15*t)
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
KSSV el 9 de Feb. de 2021
How the magnitude of the given function will be sqrt(A^2+B^2) ? Is it a complex number?

Iniciar sesión para comentar.

### Respuestas (1)

David Hill el 9 de Feb. de 2021
I would not use symbolic unless you need to.
x = @(t)0.113*sin(3.0*t) - 0.125*cos(3.0*t) + 0.125*exp(-0.25*t).*cos(3.15*t) - 0.0977*exp(-0.25*t).*sin(3.15*t);
t=0:.01:2*pi;
plot(t,x(t));
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Structures en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by