In the code below, I would like to shade the area between freq = 300 to freq = 3000:
freq = 100:1:10000;pnoise = -60:-.01:-159;subplot(1, 2, 1);semilogx(freq,pnoise); grid on; axis([0 10^5 -160 -70]);title('Original Plot');xlabel('Frequency (Hz)'); ylabel('Amplitude');subplot(1, 2, 2);H1=area(semilogx(freq,pnoise)); grid on; axis([0 10^5 -160 -70]);hold ontitle('Plot with Area Shaded');xlabel('Frequency (Hz)'); ylabel('Amplitude');idx=freq>300&freq<3000;H=area(freq(idx),pnoise(idx));set(H(1),'FaceColor',[1 0.5 0]);
However, I am not getting the second plot to show up with the shaded region correctly. Any help is appreciated.
Best Answer