Undefined function 'int' for input arguments of type 'char'. keep getting error using matlab2015b
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Walter Roberson
il 8 Dic 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 Commenti
Brian Hart
il 8 Dic 2018
Modificato: Brian Hart
il 8 Dic 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 Commenti
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!