필터 지우기
필터 지우기

How do i write this differential equation in matlab?

조회 수: 1 (최근 30일)
Augustine Nashwan Aziz Al-Zebary
댓글: Star Strider 2021년 5월 13일
global R C u
R = 10e3;
C = 3.3e-6;
tau = R*C;
u = @(t) 10*(t>tau);
The initial value is uC(0)=0
I want to write the diff equation in a function and use ode45 to solve it. Can someone please help me? i've tried everything but i dont understand how to write it into a function and how to solve it. Would be really appreciated!

채택된 답변

Star Strider
Star Strider 2021년 5월 12일
There are several options, including using the numerical solvers.
This approach uses the Symbolic Math Toolbox —
syms C R uc(t) u
eqn = R*C*diff(uc)+uc == u;
uc(t) = dsolve(eqn, uc(0)==0)
uc(t) = 
uc = subs(uc,{C,R,u},{1E-9,1E+3,sin(2*pi*t)})
uc(t) = 
figure
fplot(uc, [0 10])
grid
.
  댓글 수: 5
Augustine Nashwan Aziz Al-Zebary
I got it working, big thanks for the help!
Star Strider
Star Strider 2021년 5월 13일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by