MATLAB: Plotting all indices in a for loop for loopMATLABplotting i have this code for n=1:35 A = sin(n*3) B= cos(n^2)*3)) plot (A,B) end however when i plot it only plots the last point, how can i plot all of the points in the array? Best Answer This should work:for n=1:35A(n) = sin(n*3)B(n) = cos(n^2)*3))plot (A,B)end Related SolutionsMATLAB: How to plot in a for loop Use the bsxfun function to automatically expand the vectors:x = linspace(0, 2*pi, 100);A = 1;B = 1;n = 1:3;y = bsxfun(@power, A*(x+B), n');for n = 1:3 plot(x,y); hold onendhold offNote the transpose (') operator on ānā. MATLAB: Integrating Indices [sorted_A, sort_indexes] = sort(A,2); Related QuestionArrange indicesPicking indices randomly
Best Answer