MATLAB Answers

0

Undefined function 'int' for input arguments of type 'char'. keep getting error using matlab2015b

Asked by Brenda Galabe on 8 Dec 2018 at 22:48
Latest activity Edited by Brian Hart on 8 Dec 2018 at 23:05
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 Comments

Sign in to comment.

Products


Release

R2015b

2 Answers

Answer by Walter Roberson
on 8 Dec 2018 at 22:59

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 Comments

Sign in to comment.


Answer by Brian Hart on 8 Dec 2018 at 23:04
Edited by Brian Hart on 8 Dec 2018 at 23:05

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 Comments

Sign in to comment.