Error in the execution of the simultaneous differential equation
Info
This question is closed. Reopen it to edit or answer.
Show older comments
i want the follwing code in matlab but it showing the error message, herewith i am attaching a jpeg file with complete code and error message which i ma getting after executing the program. or if you wnat to the complete problem then you can follow the following math work link https://in.mathworks.com/matlabcentral/answers/questions/new/?s_tid=gn_mlc_ans_ask

syms f(t) g(t)
syms f(t) g(t)
[f(t), g(t)] = dsolve(diff(f) == 3*f + 4*g, diff(g) == -4*f + 3*g, f(0) == 0, g(0) == 1)
Answers (2)
Walter Roberson
on 24 Jul 2015
The code in your posted image corresponds to
syms f(t)g(t)
with no space between the f(t) and g(t).
8 Comments
Ashish Kumar
on 25 Jul 2015
Edited: Walter Roberson
on 25 Jul 2015
Walter Roberson
on 25 Jul 2015
The difficulty is detected at run-time, not at parse time. MATLAB does not know that
syms f(t)g(t)
is not valid syntax, so it calls
syms('f(t)g(t)')
and syms() complains about the syntax.
Just fix the syntax:
syms f(t) g(t)
Ashish Kumar
on 25 Jul 2015
Edited: Walter Roberson
on 25 Jul 2015
Walter Roberson
on 25 Jul 2015
I do not have the symbolic toolbox so I cannot send an image of it executing.
Ashish Kumar
on 25 Jul 2015
Walter Roberson
on 25 Jul 2015
I am executing the code in my mind, taking into account documentation such as "Creating Symbolic Functions"
If at some point I need to check the mathematics, I will use a non-Mathworks product that does not use "syms".
Ashish Kumar
on 25 Jul 2015
Walter Roberson
on 27 Jul 2015
Here is what happens if I try it in MATLAB:
syms f(t) g(t)
syms f(t) g(t)
[f(t), g(t)] = dsolve(diff(f) == 3*f + 4*g, diff(g) == -4*f + 3*g, f(0) == 0, g(0) == 1)
Undefined function 'syms' for input arguments of type 'char'.
This is exactly what is to be expected for people who do not have the Symbolic Mathematics toolbox.
Torsten
on 27 Jul 2015
Edited: Walter Roberson
on 27 Jul 2015
0 votes
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!