| 331 | |
| 332 | == Matched Filter == |
| 333 | {{{#!matlab |
| 334 | % Zhuohuan Li |
| 335 | % Sid Mandayam |
| 336 | |
| 337 | antenna = phased.IsotropicAntennaElement('FrequencyRange',[5e9 15e9]); |
| 338 | transmitter = phased.Transmitter('Gain',20,'InUseOutputPort',true); |
| 339 | fc = 10e9; |
| 340 | target = phased.RadarTarget('Model','Nonfluctuating',... |
| 341 | 'MeanRCS',1,'OperatingFrequency',fc); |
| 342 | txloc = [0;0;0]; |
| 343 | tgtloc = [5000;5000;10]; |
| 344 | transmitterplatform = phased.Platform('InitialPosition',txloc); |
| 345 | targetplatform = phased.Platform('InitialPosition',tgtloc); |
| 346 | [tgtrng,tgtang] = rangeangle(targetplatform.InitialPosition,... |
| 347 | transmitterplatform.InitialPosition);waveform = phased.RectangularWaveform('PulseWidth',25e-6,... |
| 348 | 'OutputFormat','Pulses','PRF',10e3,'NumPulses',1); |
| 349 | c = physconst('LightSpeed'); |
| 350 | maxrange = c/(2*waveform.PRF); |
| 351 | SNR = npwgnthresh(1e-6,1,'noncoherent'); |
| 352 | Pt = radareqpow(c/fc,maxrange,SNR,... |
| 353 | waveform.PulseWidth,'RCS',target.MeanRCS,'Gain',transmitter.Gain);transmitter.PeakPower = Pt;radiator = phased.Radiator('PropagationSpeed',c,... |
| 354 | 'OperatingFrequency',fc,'Sensor',antenna); |
| 355 | channel = phased.FreeSpace('PropagationSpeed',c,... |
| 356 | 'OperatingFrequency',fc,'TwoWayPropagation',false); |
| 357 | collector = phased.Collector('PropagationSpeed',c,... |
| 358 | 'OperatingFrequency',fc,'Sensor',antenna); |
| 359 | receiver = phased.ReceiverPreamp('NoiseFigure',0,... |
| 360 | 'EnableInputPort',true,'SeedSource','Property','Seed',2e3); |
| 361 | filter = phased.MatchedFilter(... |
| 362 | 'Coefficients',getMatchedFilter(waveform),... |
| 363 | 'GainOutputPort',true);wf = waveform(); |
| 364 | [wf,txstatus] = transmitter(wf); |
| 365 | wf = radiator(wf,tgtang); |
| 366 | wf = channel(wf,txloc,tgtloc,[0;0;0],[0;0;0]); |
| 367 | wf = target(wf); |
| 368 | wf = channel(wf,tgtloc,txloc,[0;0;0],[0;0;0]); |
| 369 | wf = collector(wf,tgtang); |
| 370 | rx_puls = receiver(wf,~txstatus); |
| 371 | [mf_puls,mfgain] = filter(rx_puls); |
| 372 | Gd = length(filter.Coefficients)-1;mf_puls=[mf_puls(Gd+1:end); mf_puls(1:Gd)]; % main line of matched filter |
| 373 | subplot(2,1,1) |
| 374 | t = unigrid(0,1e-6,1e-4,'[)'); |
| 375 | rangegates = c.*t; |
| 376 | rangegates = rangegates/2; % end with this lineplot(rangegates,abs(rx_puls)) |
| 377 | title('Received Pulse') |
| 378 | xlabel('Meters') |
| 379 | ylabel('Amplitude') |
| 380 | hold on |
| 381 | plot([tgtrng, tgtrng], [0 max(abs(rx_puls))],'r') |
| 382 | subplot(2,1,2) |
| 383 | plot(rangegates,abs(mf_puls)) |
| 384 | title('After Matched Filter') |
| 385 | xlabel('Meters') |
| 386 | ylabel('Amplitude') |
| 387 | hold on |
| 388 | plot([tgtrng, tgtrng], [0 max(abs(mf_puls))],'r') |
| 389 | hold off |
| 390 | }}} |
| 391 | |