MATLAB: Stem-plot difference of equations

stem plot

Here is the question
Find numerically and stem-plot the solutions of the difference equations [1<=k<=10]
a. y(k+1) - 3*k*y(k) = 0
b. y(y+1) - k*y(k) = 1
assume that y(1)=1
not sure if i am looking at this properly but here is what i was thinking. a and b do not have the same y values after 1 since in order to get 0 for the first one y(2) needs to be 3 while for equation b y(2) needs to be 2. So solve them differently and then plot? i am not sure which would be my x and y for stem plot as well. This looks simple but its confusing me not sure if am over thinking.
Thank you for your time

Best Answer

Once you have the set of values x1 with y1, and x2 with y2, you can use interp1() to interpolate each set of data over a common set of times; then you can stem().
For example,
y1_interp = interp1(x1, y1, 1:10)
y2_interp = interp1(x2, y2, 1:10)
plot(1:10, y1_interp, 1:10, y2_interp)