Use any of the surface plotting functions.
However, since ‘w’ is a scalar, the Fourier transform will be a constant.
Both loop counters are the same ‘ii’ variable, nothing in either ‘a’ or ‘b’ ever changes, and ‘w’ is not subscripted to create a matrix. I leave those corrections to you.
fc = 24e9;
c = 3e8;
lambda = c/fc;
p = 25; %number of pulses
n = 25; %samples collecetd for each pulse
bw = 300e6; %300 M hz bw
T = 300e-6;
k= bw/T;
v1 = 45;
v2 = 0;
fd1 = (2*v1)/lambda;
fd2 = (2*v2)/lambda;
R1 = 150; %Range 1 20 m
R2 = 50; %Range 2 10 m
tau1 = (2*R1)/c;
tau2 = (2*R2)/c;
To1= T + tau1; %To for target 1
To2 = T + tau2; %to for target 2
fs = 300e6;
%fs1 = 1/To1; %sampling frequency for target 1
%fs2 = 1/To2;
for ii=1:p
for ii=1:n
a = exp(1i*2*pi*((((2*k*R1)/c)+fd1)*(n/fs)+(fd1*p*To1)+((2*fc*R1)/c))) ;
b = exp(1i*2*pi*((((2*k*R2)/c)+fd2)*(n/fs)+(fd2*p*To2)+((2*fc*R2)/c))) ;
w = a + b ;
end
end
x = fft2(w,n,p);
figure
surf(real(x))
grid on
figure
surf(imag(x))
grid on
figure
surf(abs(x))
grid on
.