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월 29일
@USER SEEF — Please do not remove the question text.
Rena Berman
Rena Berman 2021년 12월 13일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (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