Im trying to solve the following ODE, with has a peculair cubic-root as a nonlinearity (p). If this nonlinearity is uneven natural number, this is solved within a second.
But for the cubic root case, the solver doesn't seem to able to solve this. I've added a progress bar ( text-progress-bar-for-odes ) but it seems to be stuck at 0 %. Maybe the infinite derivative of x^1/3 at the origin is the problem.
Does anybody know how to get this simulation working? Thanks.
m = 1;
k = 1;
c = 0.000;
omega0 = sqrt(k/m);
x0_dot = 0.1;
Tl = 20;
%%NES
mna =0.02;
cna = 0.002;
kna = 0.4444;
p = 1/3;
f1 = @(t,y)[y(3);y(4);...
-(k*y(1) + c*y(3)+ kna*(y(1)-y(2))^p+cna*(y(3)-y(4)))/m;...
-(kna*(y(2)-y(1))^p + cna*(y(4)-y(3)))/mna;...
];
Prec = 1e-14;
options = odeset('RelTol',Prec,'AbsTol',[Prec Prec Prec Prec],'OutputFcn',@odetpbar);
[T1,Y1] = ode45(f1,[0 Tl],[0 0 x0_dot 0],options);

 채택된 답변

Torsten
Torsten 2018년 1월 19일
편집: Torsten 2018년 1월 19일

2 개 추천

Instead of x^p, write sign(x)*(abs(x))^p.
Best wishes
Torsten.

댓글 수: 2

Or use nthroot. As an example, (-8)^(1/3) returns a complex value:
>> (-8)^(1/3)
ans =
1.0000 + 1.7321i
There are three cube roots of -8, and one of them is real.
>> roots([1 0 0 8])
ans =
-2.0000 + 0.0000i
1.0000 + 1.7321i
1.0000 - 1.7321i
The nthroot function returns the real cube root.
>> nthroot(-8, 3)
ans =
-2
dikkemulle
dikkemulle 2018년 1월 19일
Thanks! I should always check what something returns in Matlab before putting this in the ODE function!
Thanks,
Kevin

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

추가 답변 (0개)

카테고리

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

질문:

2018년 1월 19일

댓글:

2018년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by