HOW TO GET THE VALUES OF CONSTANTS

5 次查看(过去 30 天)
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

回答(1 个)

John D'Errico
John D'Errico 2021-4-16
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
ans =
3.14159265358979
syms y(x)
ode = diff(y,x,2) == 0;
ySol(x) = dsolve(ode,y(0) == 0,y(pi) == 0)
ySol(x) = 
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.

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by