It may depend on your MATLAB version. Assuming I interpreted your equation correctly, in R2016a, this code:
syms x(t) y(t) y0
[y]=dsolve(diff(y) == exp(2*x)*cos(y)^2, y(0) == y0)
produces this result:
y =
atan(tan(y0) + int(exp(2*x(x)), x, 0, t, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true))
Alternatively, if ‘y’ is a function of ‘x’ rather than ‘t’, this works:
syms y(x) y0
[y]=dsolve(diff(y) == exp(2*x)*cos(y)^2, y(0) == y0)
y =
atan(exp(2*x)/2 + tan(y0) - 1/2)
Choose the one that works for you.
Best Answer