MATLAB: Plotting a discrete signal that starts from -2 discreteplottingstem x=[1,-2,4,6,-5,8,10];stem(x); i want to plot x , but x(0)=-5. Best Answer If you don't want just default x-axis values of 1 upto the length of the array you need to define the values and plot e.g.stem( x, y )where y would normally be what you have called x and x would be e.g.x = -4:2y = [1,-2,4,6,-5,8,10];I guess if you want x = 0 at y = -5. Related SolutionsMATLAB: Extract data from plot Maybe like thisclc;clear;x=[1 2 3 4 5]; %x datay =[2 4 6 8 10];%y datayy=6.5 % y value you intend to reachxx = interp1(y,x,yy,'spline') %interpolation type, i choose spline, but you can choose pchip,lineer etc...plot(xx,yy,'o'); %plot valuehold onplot(x,y,'r'); grid on; %plot x y datas MATLAB: Plot a discrete signal stem(x(1:20))will plot the first 20 samples of x, assuming it has that many. Orstem(x(345:364))etc, to plot some other arbitrary section of 20 samples. Related QuestionPlot with a lag, Part 2Creation of multiple rectangles
Best Answer