Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

My Windows cracked?(MATLAB)

  1. Feb 12, 2007 #1
    My Windows cracked!?!?(MATLAB)

    Helloe, I am currently trying implement a blackman window. I am simulating one dimensional echo imaging for a class project. I am going to post the code I have and hope someone can help figure out why my plot is not coming out right. My plot just seems to be alot of noise. I should be getting 5 distinct narrow pulses very simliar to a series of impulse functions. If I have omitted any key info please let me know.

    clear;
    tau = 1e-6; % pulse duration
    alpha = 5e14; % chirp rate
    B = (alpha*tau)/pi; % bandwidth in Hz
    dt = 1/B; % Nyquist sampling rate
    dt = dt/1.2; % guard band
    xc = 1000; % mean range
    x0 = 100; % plus/minus x0 is target area size
    c = 3e8; % speed of wave propagation
    fc = 1e9; % carrier frequency

    ts = 2*(xc - x0)/c; % start sampling time
    tf = 2*(xc + x0)/c + tau; % end sampling time
    N = 2*ceil(0.5*(tf - ts)/dt); % number of samples, Have to do 'ceil' to get an integer
    t = ts + (0:N - 1)*dt; % time array
    dx = c*dt/2; % range spacing
    x = xc + dx*(-N/2:N/2 - 1); % range array

    % Simulation
    ntarget = 5; % number of targets
    xn = zeros(1, ntarget); % initialize range location
    fn = xn; % initialize reflectivity
    xn(1) = xc; fn(1) = 0.8; % These values are arbitrary
    xn(2) = xc - 0.35*x0; fn(2) = 0.5;
    xn(3) = xc + 0.50*x0; fn(3) = 0.7;
    xn(4) = xc - 0.90*x0; fn(4) = 1.0;
    xn(5) = xc + 0.60*x0; fn(5) = 0.9;

    s = zeros(1, N); % initialize echo array
    for i = 1:ntarget
    td = t - 2*xn(i)/c;

    %****Beginning of Window Code****
    ss = fn(i)*exp(j*2*pi*fc*td + j*alpha*(td.^2)).*((td >= 0) & (td <= tau));
    count = 0;
    for m = 1:N
    if td(m) <= 0 & td(m) <= tau
    count = count + 1;
    y=m;
    end;
    end;
    % s = s + 0.1*(randn(1, N) + j*randn(1, N)); % Generate noise with 0 mean and standar deviation 1

    %Now the noise is added to the measured signal and a blackman window is
    %multipled
    s = s + ss.*[zeros(1, y-count) blackman(count)' zeros(1, N-y)];
    %****End of Window Code****

    end

    w=[zeros(1, y-count) blackman(count)' zeros(1, N-y)];
    figure;plot(w);

    sb = s.*exp(-j*2*pi*fc*t); % Baseband conversion

    % Synthesize Reference Signal
    td = t - (2*xc)/c;
    s0 = exp(j*2*pi*fc*td + j*alpha*(td.^2)).*((td >= 0) & (td <= tau));
    s0b = s0.*exp(-j*2*pi*fc*t); % Baseband conversion

    % Imaging
    sb = fftshift(fft(fftshift(sb)));
    s0b = fftshift(fft(fftshift(s0b)));


    F = (sb./s0b);
    Fm = (sb.*conj(s0b));
    f = fftshift(ifft(fftshift(F)));
    fm = fftshift(ifft(fftshift(Fm)));

    figure;
    subplot(2, 1, 1);
    plot(x, abs(f));
    xlabel('Range');
    ylabel('Magnitude');
    title('Range Imaging');

    subplot(2, 1, 2);
    plot(x, abs(fm));
    xlabel('Range');
    ylabel('Magnitude');
    title('Range Imaging using Match Filtering');
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: My Windows cracked?(MATLAB)
Loading...