Hi, I keep receiving an error and I can't figure out how to get around it.
function [v3]=ParachuteMuller(m0,m1,m2)
%2/11/2020 William D.
%MULLER'S METHOD: PROBLEM 7.11
ea=5;
es=1;
iter=1;
itermax=100;
g=9.81;
c=15;
v=35;
while es<ea && iter<itermax
f0=@(m0) (g*m0/c)*(1-e^(-c*t/m0))-v;
f1=@(m1) (g*m1/c)*(1-e^(-c*t/m1))-v;
f2=@(m2) (g*m2/c)*(1-e^(-c*t/m2))-v;
c=f2; %c value
h0=m1-m0; %h0 value
h1=m2-m1; %h1 value
delta0=(f1-f0)/(m1-m0); %delta0 calculated value
delta1=(f2-f1)/(m2-m1); %delta1 calculated value
a=(delta1-delta0)/(h1+h0); %calculated a value
b=a*h1+delta1; %calculated b value
if sign(b)==1 %for + value of b use +
m3=m2+(-2*c)/(b+sqrt(b^2-4*a*c));
elseif sign(b)==-1 %for – value b use –
m3=m2+(-2*c)/(b-sqrt(b^2-4*a*c));
end
if m3~=0
ea=abs((m3-m2)*100/m3); %calculated approx. error
end
m0=m1; %replace x0 with x1
m1=m2; %replace x1 with x2
m2=m3; %replace x2 with calculated x3 value
iter=iter+1; %increase iteration
end
%Nobody Cares, Work Harder
%Keep Hammering
end
ERROR MESSAGE:
Undefined operator '-' for input arguments of type 'function_handle'.
Error in ParachuteMuller (line 22)
delta0=(f1-f0)/(m1-m0); %delta0 calculated value
Best Answer