Discrete vactors plotting problem

Pawel Jung on 23 Oct 2020
Latest activity Reply by Jeff Alderson on 23 Oct 2020

I would like to plot 2 discrete vectors on one graph created as follows: u=1; X={u,2*u,3*u,4*u,5*u,6*u,7*u,8*u,9*u}; Y={u,3*u,5*u,-u,-6*u,u-u,u^2,u^3,u^4}; stem(X,Y) unfortunately system returns error how to do it properly?

Jeff Alderson
Jeff Alderson on 23 Oct 2020

Please share the actual code you are using along with the MATLAB output. At first glance, the stem function (https://www.mathworks.com/help/matlab/ref/stem.html) requires X and Y to be vectors. The way you have them defined appears to be a cell array. Try using [ ] instead of { }.