필터 지우기
필터 지우기

Problem with the shooting method

조회 수: 1 (최근 30일)
Melda Harlova
Melda Harlova 2019년 5월 10일
댓글: Jan 2019년 5월 10일
Helloo,
Can someone help me with that code in matlab:
function main
y0=0;
y0=fsolve(@fun1,y0);
x0=[0.6,y0];
[t,x]=ode45(@fun2,[0 4], x0);
plot(t,x(:,1),t,x(:,2),'r')
function f=fun1(y)
x0=[0.6;y];
[t,x]=ode45(@fun2,[0 4],x0);
n=length(t);
f=x(n,1)+0.1;
function dx=fun2(t,x)
dx(1,1)=x(2);
dx(2,1)= -2*x(2)-2*x(1) + e^(-t) + sin(2*t);
That code must solves this task
x'' = -2x'(t) – 2x(t) + e^(-t) + sin(2t)
t ϵ [0,4]; x(0) = 0,6; x(4) = -0,1 with shooting method
but code doesnt run in matlab because of errors.
Thanks in advance.
  댓글 수: 2
Torsten
Torsten 2019년 5월 10일
Replace "e^(-t)" by "exp(-t)".
Jan
Jan 2019년 5월 10일
@Melda: A general rule in the forum: If you mention, that there is an error, post a copy of the complete error message. It is a good idea to share this important information with the readers.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Assembly에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by