Hi,
I have this task about convolution and I need to write it as a code
in matlab.
I have input signal x[n]=0.3 ∗ sin(n/5) + sin(n/50) :
a) Create your own delta signal h[m] that removes the higher frequency sinusoidal component to get yl[n].
b) Subtract the yl[n] from the original signal(x[n]) and get the higher frequency component yh[n] (pay attention to array sizes and phase shift) .
c) Plot x[n], yl[n] and yh[n] on the same graph
%% PART 1
n=-1000:1:1000; %% time defined
wc=1/50; %% cutoff freqeuncy
h=(wc/pi)*sinc(wc*n); %% filter defined
x=0.3*sin(n/5)+sin(n/50); %%input signal
yl=conv(x,h); %%convolution
p=length(x);
q=length(h);
n1=-(p+q)/2+1:1:(p+q)/2-1; %% TIME DEFINED
x1=0.3*sin(n1/5)+sin(n1/50);
%% PART 2
yh=x1-yl; %%HIGH FREQUENCY DEFINED
%% PART 3
%% MULTIPLE GRAPH PLOTTED AT SAME TIME
hold on
plot(n1,yl,'r')
plot(n1,yh,'o')
plot(n1,x1)
hold off
ylabel('amplitude');
xlabel('time');
Get Answers For Free
Most questions answered within 1 hours.