SONAR angle-range plot
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi,
i am doing a project related to sonar. I want to get a range bearing plot of sonar. If the range of the target is 300 and bearing angle is 70 degrees, how can i get the plot showing a red point at (70,300). My program is given below.
clc;
close all;
clear all;
f=3000;%frequency of the transmitted pulse
fs=16000;%sampling frequency
N=10000;%number of samples required in the pulse
theta = 70; %Angle of target
d = 0.20; %spacing between sensors
M = 8; %No of sensors
c=1500;%velocity of sound in water
target_range=300;%range of the target is .3km
max_range=1500;
max_delay=2*max_range/c;
max_delay_samples=max_delay*fs;
x=0.02*randn(1,max_delay_samples);%random noise signal with 10000 samples
t=[0:N-1]/fs;
y=sin(2*pi*f*t);%pulse signal
l=2*fs*target_range/c;
x(l:l+N-1)=y;%inserting the pulse signal to the random noise at the corresponding sample locations
figure
plot(x)
%%inverse beamformer
del = [0:M-1]*d*cosd(theta)/c;
inputSignal=delayseq(x',del,fs);
%%Beamformer
C=0;
Phi = 0:180;
cnt=0;
T=0;
for i =1:length(Phi)
cnt=cnt+1;
del(cnt,:) = -[0:M-1]*d*cosd(Phi(i))/c;
outputSensorSignal = delayseq(inputSignal,del(cnt,:),fs);
outputSignal(i,:) = sum(outputSensorSignal');
outputPower(i) = var(outputSignal(i,:));
[xc,lags] = xcorr(outputSignal(i,:),y);
[value,I] = max(abs(xc));
L=lags(I);
range(i)=(c*L)/(2*fs);
end
[O,K]=max(outputPower);
[xc,lags] = xcorr(outputSignal(K,:),y);
[value,I] = max(abs(xc));
L=lags(I);
Range=(c*L)/(2*fs)
figure
plot(lags,xc)
legend(sprintf('Maximum at lag %d',L))
title('Cross-Correlation Sequence')
figure
plot(Phi,outputPower)
title('beamformer')
댓글 수: 0
채택된 답변
Geoff Hayes
2015년 10월 12일
편집: Geoff Hayes
2015년 10월 12일
Sreya - is your 70 degrees relative to north? If so, then you should be able to use the following equations to get (x,y) coordinates of the target relative to the origin (or your sensor).
bearingDegs = 70; % degreees
rangeMtrs = 300; % metres
x = rangeMtrs*sind(bearingDegs);
y = rangeMtrs*cosd(bearingDegs);
h = figure;
hold on;
plot(0,0,'bx'); % plot the origin/sensor
plot(x,y,'ro'); % plot the target
댓글 수: 2
Geoff Hayes
2015년 10월 15일
Why do you want to use imagesc? Is there something else you want to show in the image and the target is just one other piece added to it?
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!