% --- 1.
SETUP: Clean Workspace & Figure ---
clc;
clear;
close all;
% --- 2. SYMBOLIC DEFINITION: Tell MATLAB what's symbolic ---
% Syntax: syms dependent_var(independent_var)
% What to change: 'y' and 't' to match YOUR ODE's variables.
syms y(t)
% --- 3. SOLVE: Define and solve the ODE ---
% Syntax: solution_var(independent_var) = dsolve(ODE_equation, condition1, ...,
independent_var_name)
% What to change:
% - 'diff(y)' for dy/dt (or diff(y,t,2) for d^2y/dt^2, etc.)
% - The right side of the ODE equation.
% - The initial/boundary condition (e.g., y(0)==value, diff(y,t)==value).
y(t) = dsolve(diff(y) == 0.01*sin(y)*cos(t), y(0)==0.05);
% --- 4. PLOT: Prepare for numerical plotting ---
% Syntax: numerical_independent_var_range = start:step:end;
% What to change: The range and step size for your independent variable.
t= 0:0.1:1;
% --- 5. PLOT: Create the graph ---
% Syntax: plot(x_data, y_data, 'LineSpec', ...);
% What to change:
% - 't' for x-axis data.
% - 'y(t)' to evaluate your symbolic solution numerically.
% - Line properties ('r', 'LineWidth', etc.)
plot(t, y(t), 'r', 'LineWidth', 2);
% --- 6. LABELS: Add descriptions to your plot ---
xlabel('t');
ylabel('y');
% (Optional: add a title)
% title('Analytical Solution of My ODE');
grid on;