MATLAB: Calculating answers for ODE question

ode

disp ('c) dy/dt=e^(2x)*cos^(2)*y')
[y]=dsolve('Dy=exp^(2*x)*cos^(2)*y','x')
I keep getting error, and i need to provide answer what am I doing wrong?

Best Answer

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.