Hi guys, my problem is that i want to show my original signal and decimated signal on the same plot but am not sure how to do this as the sampling rates are different. Any ideas? I am currently plotting them separately.
Rich (BB code):
nsamp = 512; %signal duration, 64ms fs1 = 8000; %samp frequency N = 2; %decimation factor fs2 = fs1/2; %target samp frequency fc = 3500; %cutoff frequency n = 40; %filter order x1 = 0; % generate the required signal for fa = 600:600:3600 x1 = x1 + sin(2.*pi.*(0:nsamp-1).*fa/fs1); end %filter Wn = fc/fs1; b=fir1(n, Wn); x1_fltrd = filter(b,1,x1); % decimate x2 = x1_fltrd(1:N:end); %plot figure(1); time_axis = ((0:nsamp-1)*0.064); plot(time_axis, x1); % Plot original sine wave figure(2); time_axis1 = ((0:nsamp-257)*0.064); plot(time_axis1, x2,'r');