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!