Solve nonlinear equation

hi,I want to solve this problem g=(2*k-1)*y^(k-1)-((1-y^(k-1))/(1-y));
with different k and compute real and positive y so I wrote this problem in matlab :

clear
clc
syms y k
g=(2*k-1)*y^(k-1)-((1-y^(k-1))/(1-y));
s=input('k=');
r=subs(g,k,s);
d=solve(r,y)

for example for k=23, d is :
d =

-0.81811283931382571520293209145876
0.94489877227954174128854689719319
0.49817720691940700053271532985098*i + 0.70274012247267906457267465202869
0.8277411118536081744820266610328*i + 0.091223969497361113040570073727308
0.70274012247267906457267465202869 - 0.49817720691940700053271532985098*i
0.77618594017326471476948567264672*i + 0.31945829898333809762888417711851
0.66408105322563369425240846687412*i + 0.52794201445903356864325220084683
- 0.81578326314656692336119246927549*i - 0.14054570047225202321477692915064
0.31945829898333809762888417711851 - 0.77618594017326471476948567264672*i
- 0.43526833501145662377255480027818*i - 0.69440096303504092329530844495529
- 0.2261452657095273445108974567173*i - 0.78660416168374227478532096534373
0.74176587152245045340265355683142*i - 0.35904590888321456580860087033279
0.83524761241076784983622123703462 - 0.2867812308408161156768712484769*i
- 0.61159735082182773643471203553956*i - 0.5482971391206768085492914227296
0.2261452657095273445108974567173*i - 0.78660416168374227478532096534373
- 0.74176587152245045340265355683142*i - 0.35904590888321456580860087033279
0.81578326314656692336119246927549*i - 0.14054570047225202321477692915064
0.61159735082182773643471203553956*i - 0.5482971391206768085492914227296
0.52794201445903356864325220084683 - 0.66408105322563369425240846687412*i
0.2867812308408161156768712484769*i + 0.83524761241076784983622123703462
0.43526833501145662377255480027818*i - 0.69440096303504092329530844495529
0.091223969497361113040570073727308 - 0.8277411118536081744820266610328*i

but I want real and positive y, how can I access real and poitive number in d?

clear
echo on
syms y k
g=(2*k-1)*y^(k-1)-((1-y^(k-1))/(1-y));
s=input('k=');
r=subs(g,k,s);
d=solve(r,y);
d1=double(d);
a=d1>0&imag(d1)==0;
disp(d1(a))