Why am I not getting the right command window message?

조회 수: 1 (최근 30일)
Alicia
Alicia 2022년 6월 21일
답변: Pooja Kumari 2023년 11월 17일
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
Karan Kannoujiya
Karan Kannoujiya 2022년 6월 21일
What you wanted to to display? We want more explaination.

댓글을 달려면 로그인하십시오.

답변 (1개)

Pooja Kumari
Pooja Kumari 2023년 11월 17일
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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by