Undefined function 'int' for input arguments of type 'char'. keep getting error using matlab2015b
조회 수: 1 (최근 30일)
이전 댓글 표시
eqa= 'diff(y(t),t)+y(t)-cos(t)';
neweq1a = laplace(eqa,t,s)
neweq1i = laplace(int('y(x)','x','0','t'),t,s)
neweq1 = neweq1a + neweq1i;
neweq2 = subs(neweq1,'y(0)',0)
lneweq2 = subs(neweq2,'laplace(y(t),t,s)',Ys)
soln = solve(lneweq2,Ys)
ysol = ilaplace(soln,s,t)
댓글 수: 0
답변 (2개)
Walter Roberson
2018년 12월 8일
You probably do not have the Symbolic Toolbox installed.
Note that that code would not work in current versions of MATLAB (R2018a and later.) It should be modernized even for your version.
syms s x y(t) Ys
dy = diff(y(t), t);
eqa= dy + y(t) - cos(t);
neweq1a = laplace(eqa, t, s)
inty = int(y(x), x, 0, t);
neweq1i = laplace(inty, t, s)
neweq1 = neweq1a + neweq1i;
neweq2 = subs(neweq1, y(0), 0)
lapy = laplace(y(t), t, s)
lneweq2 = subs(neweq2, lapy, Ys)
soln = solve(lneweq2, Ys)
ysol = ilaplace(soln, s, t)
This still requires the Symbolic Toolbox, but has been rewritten to avoid needing to process character strings.
댓글 수: 0
Brian Hart
2018년 12월 8일
편집: Brian Hart
2018년 12월 8일
In the first line you define an eqution as a text string (in quotes). Then in the second line you pass that text string into the laplace function, which expects a symbolic function. See the help pages for laplace and syms.
I think your specified error comes from the third line. The function int also wants a symbolic function, not text (which is of type 'char').
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!