using MATLAB for space link

1 visualización (últimos 30 días)
N/A
N/A el 28 de Oct. de 2021
Comentada: Rena Berman el 13 de Dic. de 2021
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 comentarios
Star Strider
Star Strider el 29 de Oct. de 2021
@USER SEEF — Please do not remove the question text.
Rena Berman
Rena Berman el 13 de Dic. de 2021
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuestas (2)

Star Strider
Star Strider el 28 de Oct. de 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.
.

Walter Roberson
Walter Roberson el 28 de Oct. de 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:
  1. use fplot() to plot the expression. This is easy, but you do not really have access to the computation results afterwards
  2. subs() numeric values in for the symbolic variables and double() the result; then plot()
  3. 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.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by