Invalid Initial Conditions Error
5 views (last 30 days)
Show older comments
I keep getting an invalid initial condition error and I don't have enough experience using MATLAB to properly debug.
Running this code,
syms x(t) y(t) z(t) Dx Dy Dz Dx_i Dy_i Dz_i;
Dx = dsolve(diff(x, t) == x);
Dy = dsolve(diff(y, t) == y);
Dz = dsolve(diff(z, t) == z);
Dx_i = diff(x(0)) == 0;
Dy_i = diff(y(0)) == 0;
Dz_i = diff(z(0)) == 0;
cond = [x(0) == 1, y(0) == -1, z(0) == 1, Dx_i, Dy_i, Dz_i];
disp('Exercise 1c')
[x(t), y(t), z(t)] = dsolve([diff(x, t, 2) == 1*Dx - x - y, diff(y, t, 2) == -x - 1*Dy - y - 1*Dz, diff(z ,t ,2) == -9*z], cond)
As per as I am able to in regards to this questions,
I keep getting the error,
Error using mupadengine/feval_internal
Invalid initial conditions.
Error in dsolve>mupadDsolve (line 334)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 203)
sol = mupadDsolve(args, options);
Error in Systems_of_Equations (line 20)
[x(t), y(t), z(t)] = dsolve([diff(x, t, 2) == 1*Dx - x - y, ...
0 Comments
Answers (1)
Suresh Maddina
on 16 Dec 2020
Hi, it is my understanding that you are trying to solve the system of differential equations in (c) (equation on the above image) using the initial conditions in (d)
The dsolve is incorrectly used with Dx, Dy, Dz terms. The initial conditions Dx, Dy, Dz are incorrectly defined. You may try the following
syms x(t) y(t) z(t) Dx_i Dy_i Dz_i;
Dx_i = diff(x, t);
Dy_i = diff(y, t);
Dz_i = diff(z, t);
cond = [x(0) == 1, y(0) == -1, z(0) == 1, Dx_i(0)==0, Dy_i(0)==0, Dz_i(0)==0];
[x(t), y(t), z(t)] = dsolve([diff(x, t, 2) == 1*diff(x,t) - x - y, diff(y, t, 2) == -x - 1*diff(y,t) - y - 1*diff(z,t), diff(z ,t ,2) == -9*z], cond)
Please refer to the dsolve examples here https://www.mathworks.com/help/symbolic/dsolve.html#bve5m8o-4
0 Comments
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!