HOW TO GET THE VALUES OF CONSTANTS
8 views (last 30 days)
Show older comments
syms y(x)
pi=3.14;
ode = diff(y,x,2) == 0;
ySol(x) = dsolve(ode)
THE ANSWER COOMING IS ySol(x) =
C2 + C1*x
IF I HAVE CONDITIONS
ysol(0)=0 and ySol(pi)=0 how to get the values of c1 and c2
0 Comments
Answers (1)
John D'Errico
on 16 Apr 2021
Please don't YELL!
Next, NEVER define pi. pi already exists, and I hate to tell you, it ain't 3.14. That only happens in certain places I won't name. In MATLAB, pi is already defined, far more accurately than that.
format long g
pi
syms y(x)
ode = diff(y,x,2) == 0;
ySol(x) = dsolve(ode,y(0) == 0,y(pi) == 0)
Which is what you would expect, since if we have the ODE with no boundary conditions at all,
y'' == 0
the general solution is as you found, a linear polynomial. If that polynomial must then be zero at two points, then the polynomial reduces to the constant value 0.
0 Comments
See Also
Categories
Find more on Calculus 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!