MATLAB Answers

0

Extract a function from a table

Asked by Sarah CHOUCHENE on 17 Nov 2019 at 10:17
Latest activity Commented on by Sarah CHOUCHENE on 20 Nov 2019 at 18:54
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 Comments

Sarah CHOUCHENE on 20 Nov 2019 at 11:11
Thank you very much sir, I solved the problem of Diff.
Now I have to resolve how can I have the integration vectof of l=y. ^^
Thank you Walter Roberson.
Regards,
Walter Roberson
on 20 Nov 2019 at 16:50
What did the problem turn out to be?
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

Sign in to comment.

0 Answers