Prev: 2D Interpolation with Missing Data
Next: help with interp1: ??? Error using ==> interp1 at 261 The valuesof X should be distinct.
From: maryam on 13 Jul 2010 09:26 I write the function with two parameters and then I write the likelihood of this function,as a symbolic function I use syms command in matlab and then when I write the likehood ,the coefficients of the results is fractional but I want them to be decimal because i write this function for more than 1000 observation therefore these coefiicients are so big then because of that they are fractional matlab gives me the error that sentence is very big,then please tell me how i can write the function that the coefficients be decimal and be short?d=0.5; T=10; inf=10; alpha0=0.1; beta1=.45; h=zeros(1,T); epsilon=zeros(1,T); z=zeros(1,T); lamda=zeros(1,inf); h(1)=0.02; %z(1)=trnd(7); z(1)=random('norm',0,1); epsilon(1)=sqrt(h(1))*z(1); for t=2:T summ=0; for k=2 :inf if(t>k) lamda(k)=(1-beta1-(1-d)*1/k)*exp(d-1)*(k+d-2)^(d-1)*(1/(sqrt(2*pi))*((d-1)^(d-.5))); summ=summ+lamda(k)*epsilon(t-k)^2; end end h(t)=alpha0+summ; %z(t)=trnd(7); z(t)=random('norm',0,1); epsilon(t)=sqrt(h(t))*z(t); end series=abs(epsilon); lamda=[]; %autocorr(series,100,2) Lsum=0; syms beta dd h sumht lamda for t=2:T for k=1:(t-1) lamda(k)=((1-beta-(1-dd)*(1/k))*exp(dd-1)*(k+dd-2)^(dd-1)*(1/(sqrt(2*pi))*((dd-1)^(dd-.5)))); sumht(k)= lamda(k)*epsilon(t-k)^2; end h(t)=alpha0+sum(sumht); sumlik(t)=log(h(t))+(epsilon(t)^2)/h(t); end sumlikf=sum(sumlik); lihood=-0.5*T*log(2*pi)-0.5*sumlikf; |