Home / Expert Answers / Computer Science / in-my-attempt-in-using-matlab-to-solve-for-the-general-solution-and-particular-solution-when-y-1-pa373

# (Solved): In my attempt in using MATLAB to solve for the general solution and particular solution when y(1) = ...

In my attempt in using MATLAB to solve for the general solution and particular solution when y(1) = 1 of the question as shown in the picuture,

`y^(')=(x^(2)+3xy)/(3x^(2))`

. The following are my codings: syms x y; % Define symbolic variables syms ode; syms sol; % Define the ODE ode = (x^2 + 3*x*y)/(3*x^2); % Separate variables using manual method, then input into here eqn = int(1/(x^2 + 3*x*y), y) == int(1/(3*x^2), x); % Solve the equation sol = dsolve(eqn); % Display the general solution disp('General Solution:'); disp(sol); % Define the initial condition initial_condition = sol.subs(x, 1) == 1; % Solve for the constant of integration constant = solve(initial_condition); % Substitute the constant into the general solution to find the particular solution particular_solution = sol.subs(constant); % Display the particular solution disp('Particular Solution:'); disp(particular_solution); However, it outputs errors as shown below, i don't know where did i do wrong. Please correct and teach me. Error using mupadengine/feval2sym_NaNsingularity No differential equations found. Specify differential equations by using symbolic functions. Error in dsolve>mupadDsolve (line 334) T = feval2sym_NaNsingularity(symengine,'symobj::dsolve',sys,x,options); Error in dsolve (line 203) sol = mupadDsolve(args, options); Error in ODE_Q1 (line 12) sol = dsolve(eqn); Related documentation

We have an Answer from Expert