using MATLAB for space link
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all. I want to convert an output signal that I got from an input multiplied by a transfer function to double precision. I don't want to use fplot in this case. Is there a way to get my output signal into double precsion before I can then simply plot it? A piece of my code is below for a better idea. The outputs I need to convert to double precision are y1 and y2 as they are currently in synbolic. I'd appreciate any help.
%%Input singal at frequency F1Hz
x1 = sin(2*pi*F1Hz*t);
X1s = laplace(x1);
Y1s = X1s*H1(s);
y1 = ilaplace(Y1s);
%%Input single regular
x2 = sin(t);
X2s = laplace(x2);
Y2s = X2s*H1(s);
y2 = ilaplace(Y2s);
2 commentaires
Réponses (2)
Star Strider
le 28 Oct 2021
It depends whether they contain symbolic variables or if they are functions (and I can’t determine that from the code snippet). If they can be evaluated as functions, then plotting them would require that tney be converted to anonymous function first using the matlabFunction function, and then evaluated. If they are already vectors only of symbolic numbers, use the double function to convert them.
.
0 commentaires
Walter Roberson
le 28 Oct 2021
Your ilaplace() functions are going to be in terms of t at least, and possibly other symbolic variables as well.
If you have a symbolic expression of one variable, then there are several ways to proceed:
- use fplot() to plot the expression. This is easy, but you do not really have access to the computation results afterwards
- subs() numeric values in for the symbolic variables and double() the result; then plot()
- use matlabFunction() on the symbolic expression, and call the function on the numeric vector.
However... ilaplace() results are sometimes not very clean. In some cases, none of these approaches will work. In other cases, using matlabFunction() will give you problems unless you use arrayfun() to process one time value per call.
0 commentaires
Voir également
Catégories
En savoir plus sur Assumptions 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!