Backward differentiation of a mass matrix, Using Fzero function

1 view (last 30 days)
Hi, Following is my code. Initial conditions are given on the top of the code. I have specified an eqn which is given in inline function. A3 is a matrix of 49788*688 values and I want to find X for every values of A3. I am using fzero function but I think I am doing some mistakes in its syntax. Moreover, it say subscripts indices must be real or positive integers and there is some error in initial conditions. Can anybody correct this code? Q is equal to 49788
Cp(0)=1;
Cp(-1)=1;
for k = 1:Q;
fx = inline('3.5 *(X - 2*Cp(k-1) + Cp(k-2)) + 106*(X-Cp(k-1)) * abs(X-Cp(k-1)) + X- A3','A3');
[x,feval] = fzero(fx,0,Cp(0),Cp(-1),A3);
Cpi(k) = X;
end

Answers (0)

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!