I need to solve the following differntinal equation:
y' = -(1+2n)y
intial condition y(0)=1 , n=1

댓글 수: 2

John D'Errico
John D'Errico 2022년 10월 30일
Surely you need to do your own homework assignment?
Raef
Raef 2022년 10월 30일
Its not my homework assignment, my dad is an applied mathematics scientist and has other colleagues that do the computer work which he don't know how to use. So im trying to learn to use matlab to help and contribute so this is the simple equation he gave me to solve and see if I get a result

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

 채택된 답변

Sam Chak
Sam Chak 2022년 10월 30일

2 개 추천

@Raef, you are a good son and took up a filial duty to help your father.
n = 1;
y0 = 1; % intial value
F = @(t, y) - (1 + 2*n)*y;
[t, y] = ode45(F, [0 5], y0);
plot(t, y), grid on, xlabel('t'), ylabel('y(t)')

댓글 수: 1

Raef
Raef 2022년 10월 31일
Thanks a lot for your words and answer

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

추가 답변 (1개)

Torsten
Torsten 2022년 10월 30일

2 개 추천

Use pencil and paper.
dy/dt = -(1+2*n)*y
-> dy/y = -(1+2*n)*dt
-> log(y/y0) = -(1+2*n)*(t-t0)
-> y = ?

댓글 수: 3

Raef
Raef 2022년 10월 30일
Thanks for the response, but i needed done as a graph on matlab
Torsten
Torsten 2022년 10월 30일
편집: Torsten 2022년 10월 30일
If you know the explicit form of the solution like from the approach with paper and pencil, you can easily graph it.
If you also have to derive the solution with a MATLAB solver, either use "dsolve" or "ode45".
Raef
Raef 2022년 10월 31일
Thanks

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

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2022년 10월 30일

댓글:

2022년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by