- #1
freezer
- 76
- 0
I am creating a plot in a for loop adding each iteration to the plot in matlab. This part works fine but after the for loop, i am trying to format the title and axis and that is clearing the plot. I can add the legend without it clearing. I also tried hold all but that did not work either. Any tips to get the formatting addition to not clear the plot?
this is the plot that is in the for loop:
plot(W,M,'color',[1-ii/10 ii/10 1]); hold on Then after the for loop:
I can add the legend without it clearing if i comment out the code above.
this is the plot that is in the for loop:
plot(W,M,'color',[1-ii/10 ii/10 1]); hold on Then after the for loop:
Code:
axis([0 2500 0 1.1])
title('BPFs')
xlabel('Frequency (Hz)');
ylabel('Magnitude'); grid on
I can add the legend without it clearing if i comment out the code above.
Code:
legend(['F_c= ',int2str(fb(1)),' Hz'],['F_c= ',int2str(fb(2)),' Hz'],... % Creates the legend of the plot.
['F_c= ',int2str(fb(3)),' Hz'],['F_c= ',int2str(fb(4)),' Hz'],...
['F_c= ',int2str(fb(5)),' Hz'],['F_c= ',int2str(fb(6)),' Hz'],...
['F_c= ',int2str(fb(7)),' Hz'],['F_c= ',int2str(fb(8)),' Hz']);