Clear Filters
Clear Filters

using subplot with imaginary and real

1 view (last 30 days)
I want to use subplot for the imagenary part and the real part, is my code correct?
Screen Shot 2019-11-03 at 6.53.51 PM.png
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));

Accepted Answer

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 4 Nov 2019
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));

More Answers (0)

Categories

Find more on Detection, Range and Doppler Estimation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!