Extract a function from a table

조회 수: 2 (최근 30일)
Sarah CHOUCHENE
Sarah CHOUCHENE 2019년 11월 17일
댓글: Sarah CHOUCHENE 2019년 11월 20일
Hello,
I really need to clear up my toughts, I want to extract a fonction from a table of two dimensions ( l,t) that I recover from and ODE method.
[t,l]=ode23('odef',[t0,tf],l0)
My goal is to integrate "l" Si I need to have a function to use for exemple the simpson method :
f = inline('l','t')
h = 100/N;
Isim=0.0;
for i=1:N
Isim= Isim+h*(1/6*f(t(i))+2/3*f((t(i)+t(i+1))/2)+1/6*f(t(i+1)));
end
Isim
Of corse this program doesn't work because I used a vecto as a function !
Do you have an idea how can I integrate from data ?
Thank you,
Regards,
  댓글 수: 14
Walter Roberson
Walter Roberson 2019년 11월 20일
What did the problem turn out to be?
Sarah CHOUCHENE
Sarah CHOUCHENE 2019년 11월 20일
I made a mistake, I added another variable Like you said before on the top of the code diff=abs(l1(1:80)-l(1:80)); and I forgot about it.. Thank you

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by