Differential equation error.

The following equation need to be implemented and the graph should be obtained like this. I tried all the way, but couldn't.
clc;
close all;
clear all;
t=0:0.001:10;
I = @(t)100*sin(100*pi*t);
r0=0.0002;
Lp=1;
U0=(0.95+(0.005./I(t)));
Ust=(U0+(r0*abs(I(t))))*Lp;
G=(abs(I(t)))./Ust;
g0 = 0.1;
fun = @(t,g) (1/0.00001)*(G-g);
[T,g] = ode45(@(t,g) fun(t,g,I),0.01:0.001:5,g0);
plot(T,g);

답변 (1개)

Walter Roberson
Walter Roberson 2022년 10월 18일

0 개 추천

U0=@(t)(0.95+(0.005./I(t)));
Ust=@(t)(U0(t)+(r0*abs(I(t))))*Lp;
G=@(t)(abs(I(t)))./Ust(t);
g0 = 0.1;
fun = @(t,g) (1/0.00001)*(G(t)-g);
However using abs() violates the restriction that the function you use has continuous second derivatives.
Please see the ballode example.

댓글 수: 3

Torsten
Torsten 2022년 10월 18일
... and dividing by I(t) gives a singularity at 1/100 * n for all integer values of n.
Reji G
Reji G 2022년 10월 19일
I'm getting 5 errors. I don't know how to rectify it. But I need the graph as plotted above. Please edit the code to run and get the plot.
Walter Roberson
Walter Roberson 2022년 10월 19일
The code needs bigger changes. The function violates the continuity requirements of all ode*() solvers

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

카테고리

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

제품

릴리스

R2021b

질문:

2022년 10월 18일

댓글:

2022년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by