so now i got this far, which is kinda ok. is there a way to interpolate with interp2 so that the one row gets constant spacing. where the vz(2,:) is suposed to be interpolated to zz=1:1:zmax and the vz(1,:) gets interpolated. i also tried with the mashgrid input and entering the form vz3 = interp2 (X, Y, Z, XI, YI).
 if true
    for i=1:n+1;     %i added an extra end point by hand
    v_lin(i,:)=linspace(vz(1,i),vz(1,i+1),int);      
    z_lin(i,:)=linspace(vz(2,i),vz(2,i+1),int);      
  end   
v_lin2=[]; 
z_lin2=[];
for k=1:n+1    
    y=v_lin(k,:).';
    p=z_lin(k,:).';
    v_lin2=vertcat(v_lin2,y);
    z_lin2=vertcat(z_lin2,p);
end
v_lin2=v_lin2';
z_lin2=z_lin2';
vz2=[v_lin2 ; z_lin2]
  end
