Why am I not getting the right command window message?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I put in the right code, but my command window is not working, and I can not seem to the right message to come up. I do not know what is wrong with it or if I am making a mistake some where. Below is my coding: But my initial equation is V_c^'' (t)+8V_c^' (t)+15V_c (t)=0
and my V_c is 20 and my V_c'' is -75/2
syms y(t)
Dy = diff(y);
ode = diff(y,t,2)+8*diff(y,t)+15*y == 0;
cond1 = y(0) == 20;
cond2 = Dy(0) == -75\2;
conds = [cond1,cond2];
ysol(t) = dsolve(ode,conds);
1 comentario
Respuestas (1)
Pooja Kumari
el 17 de Nov. de 2023
Dear Alicia,
It is my understanding that you are facing issues with solving a second-order linear ordinary differential equation (ODE) using MATLAB's Symbolic Math toolbox. I have identified a couple of errors in the code that need to be corrected.
Firstly, there is an error in the code where you have defined the initial conditions. Instead of using "Dy(0) == -75\2", use "Dy(0) == -75/2" to represent -75 divided by 2.
Secondly, you have defined initial condition as “V_c''= -75/2” as "Dy(0) = -75/2" which is wrong. For a second-order differential equation, the corrected code is given below:
D2y = diff(y,t,2);
cond2 = subs(D2y, t, 0) == -75/2; % Initial Condition for V_c'' = -75/2
conds = [cond1, cond2];
You can refer to the below documentation for more information on "subs" function:
Regards,
Pooja Kumari
0 comentarios
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!