So I want to do the following function but it doesnt work. The problem probably is that I need something like a "return" at the and which I incorporated symbolically. Atm the output is empty.
function vk(k,x) res=zeros(length(x)) if k>=2 && k<=(N-1) for i=1:length(x) if x[i]<=X[k] && x[i]>=X[k-1] res[i]=(x[i]-X[k-1])/(X[k]-X[k-1]) elseif x[i]<=X[k+1] && x[i]>=X[k] res[i]=(X[k+1]-x[i])/(X[k+1]-X[k]) else res[i]=0 end end else res[:]=0 end return, res end