using subplot with imaginary and real
조회 수: 1 (최근 30일)
이전 댓글 표시
Meshaal Mouawad
2019년 11월 4일
답변: JESUS DAVID ARIZA ROYETH
2019년 11월 4일
I want to use subplot for the imagenary part and the real part, is my code correct?
c=3e8; % speed of light m/s
M=50; % 50 pulses
M_samples=M-1;
m_th= 0:1:M_samples; % m_th pulses
v=30; % the radial velocity 30m/s
f_t= 3e9; % frequency of 3.0 GHz
tau= 1e-6; % a pulse width of 1 microsecond
PRF=4e3; % a PRF of 4.0 KHz
R_0=40e3; % an initial range of R0 = 40 km
A=1; % set A to 1
theta=0; % set theta to 0
% calculate
PRI=1/PRF; % find PRI
T = PRI; % T = PRI
f_d=(2*v*f_t)/c; % Calculate the Doppler frequency Hz
m_calc=R_0/(v*T); % calculate m in equation 8.2
t_m= m_calc*T; % claculate the transmited times for the m_th pulse
t_m_2= m_th*T; % estimate the transmited times for the m_th pulse
%
% Equation 8.28
%
y_1=A*exp(i*((2*pi*f_d*t_m)+theta)); % Calculate Equation 8.28 the data y
y_2=A*exp(i*((2*pi*f_d*t_m_2)+theta)); % Estimate Equation 8.28 the data y
% b) Using subplot, plot in subplot(2,1,1) the real portion of y. In subplot(2,1,2), plot the imaginary portion.
% Let the x axis be the time of each pulse number (number pulses from 0 to M?1), in msec.
%
subplot(2,1,1);
plot (m_th,real(y_2));
subplot(2,1,2)
plot(m_th,imag(y_2));
댓글 수: 0
채택된 답변
JESUS DAVID ARIZA ROYETH
2019년 11월 4일
yes in that case, graph real and imaginary part, the only recommendation is that you put 1i instead of i so that it is not confused as a variable
c=3e8; % speed of light m/s
M=50; % 50 pulses
M_samples=M-1;
m_th= 0:1:M_samples; % m_th pulses
v=30; % the radial velocity 30m/s
f_t= 3e9; % frequency of 3.0 GHz
tau= 1e-6; % a pulse width of 1 microsecond
PRF=4e3; % a PRF of 4.0 KHz
R_0=40e3; % an initial range of R0 = 40 km
A=1; % set A to 1
theta=0; % set theta to 0
% calculate
PRI=1/PRF; % find PRI
T = PRI; % T = PRI
f_d=(2*v*f_t)/c; % Calculate the Doppler frequency Hz
m_calc=R_0/(v*T); % calculate m in equation 8.2
t_m= m_calc*T; % claculate the transmited times for the m_th pulse
t_m_2= m_th*T; % estimate the transmited times for the m_th pulse
y_1=A*exp(1i*((2*pi*f_d*t_m)+theta)); % Calculate Equation 8.28 the data y
y_2=A*exp(1i*((2*pi*f_d*t_m_2)+theta)); % Estimate Equation 8.28 the data y
subplot(2,1,1);
plot (m_th,real(y_2));
subplot(2,1,2)
plot(m_th,imag(y_2));
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Detection, Range and Doppler Estimation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!