Simpson's Rule to find total work

1 visualizzazione (ultimi 30 giorni)
Rachel Dawn
Rachel Dawn il 28 Mar 2018
Modificato: Rachel Dawn il 28 Mar 2018
If I'm given time=[0,#,#,#,#,#] and velocity=[#,#,#,#,#,#] and Force=[#,#,#,#,#,#], how could I use Simpson's rule to find the total work in this time? I know work is area under curve of Force vs distance, and I know distance/position is area under curve of velocity vs time.
So far I have this:
n=6
sum2=0
sum1=0
sumn=0
P(1)=0
for i=0:n
if i==0
sum0= v(i+1)
elseif i==n
sumn = v(i) %TA wrote v(i+1)?
elseif mod(i,2)==1
sum1=sum1 + v(i+1)
elseif mod(i,2)==0
sum2=sum2+v(i+1)
end
delt=(t(n)-t(1))/3
area1=delt*(sum0 + sumn + 4*sum2 + 2*sum2)
if i>1
P(i)= P(i-1) +area1
end
end
1) Not sure if I found the correct position values. Is it wrong to assume P(1)=0?
2)for total work, Would I repeat the same for loop, but now with Force and Position values?

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by