I am getting errors while using fsolve or fzero in the following code:
U = 1; while U < 20eq = @(q) 2.*(1-cos(2.*pi.*q));hq = @(q,n0) ((eq(q)).^2+2.*U.*n0.*(eq(q))).^0.5;y = @(q,n0) (((eq(q))+(U.*n0))./hq(q,n0))-1;a = -0.5;c = -0.01;v = @(n0) (integral(@(q) y(q,n0),a,c));cv =@(n0) n0+(0.5*v(n0))-1; n0 = fzero(cv(n0),0.1);plot(U,n0)hold on U = U + 1;end
Can anyone please help me out?
Best Answer