using MATLAB for space link

1 次查看(过去 30 天)
N/A
N/A 2021-10-28
评论: Rena Berman 2021-12-13
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 个)

Star Strider
Star Strider 2021-10-28
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 2021-10-28
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.

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by