non-linear in matlab (newton raphson) -


my problem is, when simulate coding below state value of ma=0.8 or other value less 1, answers in matlab shows nan. can me? based on newton raphson method

function vector=she(ma)  xn=4; bn=[1 5 7 11]; bvalue=[1 0 0 0]; n=10; % first 20 coefficients ntrial=20; % number of trials  i=1:xn    bnvalue(i)=2*ma*bvalue(i); % scale bn target values end  % initial seed values aid convergence alpha=[0.35 1.1 1.5 1.35];  t=1:ntrial     i=1:n       index=2*i-1;       % set number b coefficient 0       b(index+1)=0.0;       % sum components       b(index)=cos(index*alpha(1))       b(index)=b(index)+cos(index*alpha(2));       b(index)=b(index)+cos(index*alpha(3)); b(index)=b(index)-cos(index*alpha(4));       % scale       b(index) = b(index)*4/(index*pi);    end    % matrix of partial derivatives a(alpha) , negative of    % function b(alpha)     j=1:xn       b(j)=-b(bn(j)) + bnvalue(j);       a(j,1)=-4/pi*(sin(bn(j)*alpha(1)));       a(j,2)=-4/pi*(sin(bn(j)*alpha(2)));       a(j,3)=-4/pi*(sin(bn(j)*alpha(3)));       a(j,4)=4/pi*(sin(bn(j)*alpha(3)));    end    deltaalpha=a\b'; % uses lu decomposition     j=1:xn       alpha(j) =alpha(j)+deltaalpha(j);    end end  vector=alpha; % return complete set of firing angles 


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -