function [Y,freqout]=Noise_Filt(X,H,freq1,freq2)
%This gives the output PSD of a filtered noise process
%
%X is the PSD of the noise
%H is the channel response
%freq1 are the frequencies of X
%freq2 are the frequencies of H

freqout=intersect(freq1,freq2);
size(X);
size(H);
fmax=max(freqout);
fmin=min(freqout);
index1=find(freq1>=fmin & freq1<=fmax);
index2=find(freq2>=fmin & freq2<=fmax);
size(index1);
size(index2);
Y=abs(H(index2)).^2.*X(index1);
