You have the following problems:
First your $a$ and $b$ seems to be mis-named; replace b with a and a with b. Where $b$ is the numerator coefficients of the filter and $a$ is the denominator coefficients. Also note that the filter command works like this y = filter(b,a,x)
...
Then also your $f_c$ parameter is not (directly) controlling the $-3$ dB cutoff frequency (in Hz) of the high pass filter that you intend to obtain. But it's controlling th eradian per sample cutoff frequency. So you bettwe use teh notation wc
for that instaed of fc
.
In any case, your input signal frequencies are so low that they are killed by the filter and hence you see no output. Just increase their frequencies to see them at the output. Incidentally you can also decrease $f_c$ well below $0.3$ to get a tighter highpass (a DC-notch) filter..
Based on your comment, since you want a cutoff frequency in radians/sample $\omega_c$ instaed of a analog Hz frequency, then the parameter $f_c$ yields the correct discrete-time cutoff frequency. You can view the frequency response of your filter by the line figure,freqz(b,a)
. So the only problem remains is that your signakl frequencies ar too low. replace it like so
x1 = cos(0.1*fs*pi*n);
x2 = cos(0.3*fs*pi*n);
note that in your code the index $n$ has a scale of $T_s$ so the frequencies should be scaled by $f_s$ to get normalized frqeuencies in the discrete-time frequency.