Undefined function 'int' for input arguments of type 'char'. keep getting error using matlab2015b
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Walter Roberson
am 8 Dez. 2018
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 Kommentare
Brian Hart
am 8 Dez. 2018
Bearbeitet: Brian Hart
am 8 Dez. 2018
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 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!