채택된 답변

Yusuf Suer Erdem
Yusuf Suer Erdem 2021년 11월 27일
편집: Yusuf Suer Erdem 2021년 11월 27일

1 개 추천

Hi Alesna, could you try my codes below? Good luck.
clc; clear; close all;
syms y(t) k t
Dy=diff(y);
k=sqrt(2);
ode=diff(y,t,2)==k*sin(k*t);
conds = [y(0)==6, Dy(0)==0];
ySol(t)=dsolve(ode,conds)

댓글 수: 4

Art dela vega
Art dela vega 2021년 11월 28일
it works sir! thank you so much! i've been stuck for this problem for about 3 hours omg. thank you for the help sir. appreciated
Art dela vega
Art dela vega 2021년 11월 28일
sir, just one more question if it is okay. using the code that you gave i tried to answer this question.
Art dela vega
Art dela vega 2021년 11월 28일
Try these codes below. Good luck.
clc; clear; close all;
syms y(x)
Dy = diff(y);
ode = diff(y,x,2) == -5*diff(y,x)-4*y;
cond1 = y(0) == 1;
cond2 = Dy(0) == 0;
conds = [cond1 cond2];
ySol(x) = dsolve(ode,conds);
ySol = simplify(ySol);
ySol(1)

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 11월 27일

1 개 추천

You created y as a symbolic function, syms y(t)
You try to assign to ySol(y) . But y is a function, and you cannot index by a function.
You could assign to ySol(t)

댓글 수: 1

Art dela vega
Art dela vega 2021년 11월 28일
thank you sir, i found my mistakes on my codes. thank you for the help!

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

카테고리

도움말 센터File Exchange에서 Functions에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 11월 27일

댓글:

2021년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by