Error in plot(t,[y x]).. can anyone help me with this code i am trying matched filter of rectangular pulse to awgn signal..firstly i am convolving these two signals ande then taking and then matching. what is wrong in this code
Show older comments
clear; % sampling frequency fs = 1e9; % time duration for pulse of start and end td = 10e-9; % number of steps in linspace N = 513; % width of rect pulse w= 1e-9; % time t = linspace(-td,td,N); dt = t(2)-t(1); T = t(end)-t(1) + (t(2)-t(1)); f = 1/T * (-(N-1)/2 : (N-1)/2); %square pulse subplot(3,2,1) y = rectpuls(t,w); plot(t,y) xlabel('Time') ylabel('Amplitude') title('rectangular pulse') grid on; %fourier transform of square pulse: ATsinc(fT) %where f is a frequency variable. A is the amplitude of the pulse, %assumed to be 1 subplot(3,2,2) Y = w*fft(y); sz = size (y) Yplot = fftshift(Y); plot(f,abs(Yplot)) xlabel('frequency') ylabel('Amplitude') title('fft=sinc func') grid on;
% noise added with signal x = awgn(y,10,'measured'); subplot(3,2,3) plot(t,[y x]) legend('Original Signal','Signal with AWGN') title('signal and noise') grid on % convolution at multiplier s1=fft(x); s2=fft(y); y2=conv(s1,s2) subplot(3,2,4) plot(y2) title('convolution of FFT') grid on % matched filter output y3=ifft(y2); subplot(3,2,5) plot(y3) title('matched filter output') grid on
1 Comment
tk swetha
on 5 Apr 2021
Y is there a error at step x=awgn(y,10,'measured');
Accepted Answer
More Answers (0)
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!