How to get numerical value from symbolic variables in matlab?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ABTJ
le 25 Mar 2019
Réponse apportée : Walter Roberson
le 25 Mar 2019
I am studying energy and power signals in MATLAB from the book "Signals & systems laboratory with MATLAB". I am trying to implement the example code at top of page123
code is follow:
syms t T
x=heaviside(t)-heaviside(t-1);
d=int(abs(x)^2,t,-T,T);
Px=limit((1/(2*T))*d,T,inf)
Ex=limit(d,T,inf)
I am expecting a result in numeric form, as shown in book to be Px=0 and Ex=1, but when I run my code, I get the result as a big equation as follows:
Px=limit(int(abs(heaviside(t) - heaviside(t - 1))^2, t, -T, T)/T, T == Inf)/2
Ex=limit(int(abs(heaviside(t) - heaviside(t - 1))^2, t, -T, T), T == Inf, Real)
How can I get a numeric result?
0 commentaires
Réponse acceptée
Walter Roberson
le 25 Mar 2019
MATLAB is having trouble with the abs(x)^2 layer.
We as human(-ish)es can analyze and see that in context, the input arguments are always going to be real valued. With real-valued arguments, abs(x)^2 is going to be the same as x^2 . If you change to x^2 instead of abs(x)^2 then you will get a definite result.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Special Values dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!