www.gusucode.com > phased 案例源码 matlab代码程序 > phased/PropagateSignalToMovingTargetExample.m
%% Propagate Signal from Stationary Radar to Moving Target % This example shows how to propagate a signal in free space from a % stationary radar to a moving target. %% % *Note:* This example runs only in R2016b or later. If you are using an earlier % release, replace each call to the function with the equivalent |step| % syntax. For example, replace |myObject(x)| with |step(myObject,x)|. %% % Define the signal sample rate, propagation speed, and carrier % frequency. Define the signal as a sinusoid of frequency 150 Hz. Set the % sample rate to 1 kHz and the carrier frequency to 300 MHz. The % propagation speed is the speed of light. fs = 1.0e3; c = physconst('Lightspeed'); fc = 300e3; f = 150.0; N = 1024; t = (0:N-1)'/fs; x = exp(1i*2*pi*f*t); %% % Assume the target is approaching the radar at 300.0 m/s, and the radar is % stationary. Find the Doppler shift that corresponds to this relative % speed. v = 1000.0; dop = speed2dop(v,c/fc) %% % From the formula, the one-way doppler shift is 1 Hz. %% % Create a |phased.FreeSpace| System object(TM), and use it to % propagate the signal from the radar to the target. Assume the radar is at % (0, 0, 0) and the target is at (100, 0, 0). channel = phased.FreeSpace('SampleRate',fs,... 'PropagationSpeed',c,'OperatingFrequency',fc); origin_pos = [0;0;0]; dest_pos = [100;0;0]; origin_vel = [0;0;0]; dest_vel = [-v;0;0]; y = channel(x,origin_pos,dest_pos,origin_vel,dest_vel); %% % Plot the spectrum of the transmitted signal. The peak at 150 Hz reflects % the frequency of the signal. window = 64; ovlp = 32; [Pxx,F] = pwelch(x,window,ovlp,N,fs); plot(F,10*log10(Pxx)) xlabel('Frequency (Hz)') ylabel('Power/Frequency (dB/Hz)') title('Transmitted Signal') %% % Plot the spectrum of the propagated signal. The peak at 250 Hz reflects % the frequency of the signal plus the Doppler shift of 100 Hz. window = 64; ovlp = 32; [Pyy,F] = pwelch(y,window,ovlp,N,fs); plot(F,10*log10(Pyy)) grid xlabel('Frequency (Hz)') ylabel('Power/Frequency (dB/Hz)') title('Propagated Signal') %% % The doppler shift is too small to see. Overlay the two spectra in the % region of 150 Hz. figure idx = find(F>=130 & F<=170); plot(F(idx),10*log10(Pxx(idx)),'b') grid hold on plot(F(idx),10*log10(Pyy(idx)),'r') hold off xlabel('Frequency (Hz)') ylabel('Power/Frequency (dB/Hz)') title('Transmitted and Propagated Signals') legend('Transmitted','Propagated') %% % The peak shift appears to be approximately 1 Hz.