이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Finding a suitable Direction Finder Alogrithm
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi, am doing a radio direction finder project and i used parasatic monopole antenna array to switch the radiation beam in each direction. am using hackrf to capture the data and then i matlab i used this code:
function y = loadFile(filename)
% fid = fopen(filename,'rb'); y = fread(fid,'uint8=>double'); y = y-127.5; y = y(1:2:end) + i*y(2:2:end);
compass(y)
but i seem to be getting only one reading which gives me only one direction all the time. can you help me out please and is there a better way for me to process the captured file.
댓글 수: 17
Walter Roberson
2018년 6월 21일
If I remove the comment mark, then it works with the random data I created.
data = randi([0 255], [1 50],'uint8');
filename = 'test.bin';
fid = fopen(filename,'w');
fwrite(fid,data,'uint8');
fclose(fid);
fid = fopen(filename,'rb'); y = fread(fid,'uint8=>double'); y = y-127.5; y = y(1:2:end) + i*y(2:2:end);
compass(y)
Ahmed Siddig
2018년 6월 21일
Sorry about the comment mark i forgot it. So when i tried the code above with a different filename i got this error : Error using fwrite Invalid file identifier. Use fopen to generate a valid file identifier.
Error in Untitled (line 4) fwrite(fid,data,'uint8');
Ahmed Siddig
2018년 6월 21일
편집: Walter Roberson
2018년 6월 21일
For example i have this file inside it is a .bin file which i captured using the hackrf one with a sampling rate of 2000000 & a number of samples of 10 & a gain of 32 and when i try this code:
fid = fopen(ahm.bin,'rb');
y = fread(fid,'uint8=>double');
y = y-127.5;
y = max(y(1:2:end) + i*y(2:2:end));compass(y)
I end up with the direction in the middle between 90 and 180 (i believe it's 135) knowing that i captured it in the 0 direction.
thanks.
Walter Roberson
2018년 6월 21일
Note that max() applied to a complex number ignores the imaginary part.
When I look in the file, I see that the odd-numbered components are 6 or 5, and that the event components are in the range of 248 to 251. There is no way I can see that you could get an angle near 0 from that. I can manipulate it to get angles of 135.117265041982 or of 307.694240466689 but not near 0.
Ahmed Siddig
2018년 6월 21일
Ok about the max() can't i use any other function to display the highest reading. And let's say we want 307.69 how did you get that? thanks.
Walter Roberson
2018년 6월 21일
fid = fopen('ahm.bin','rb');
y = fread(fid, 'int8=>double');
fclose(fid);
t = mean(y(1:2:end)) + 1i * mean(y(2:2:end));
ang = angle(t) * 180/pi;
"highest reading" does not have a clear meaning for complex numbers.
Ahmed Siddig
2018년 6월 21일
Sorry but apparently am getting no where it still plots the same direction no matter what i tried. don't you know any way to display the direction of arrival. thanks again.
Walter Roberson
2018년 6월 21일
What do the values represent? For example if the adjusted values represent signal strength in decibels then you should probably not be doing plain vector addition on them. One plausible interpretation would be
mean(10.^(y(1:2:end) + 1i*y(2:2:end)))
angle(ans) * 180/pi
ans =
35.0483889088682
but also plausible would be
>> mean(10.^y(1:2:end) + 1i*10.^y(2:2:end))
ans =
190000 + 1.351e-06i
>> angle(ans) * 180/pi
ans =
4.07403148011443e-10
Ahmed Siddig
2018년 6월 21일
There are IQ data but the problem is that i have to plot the result in compass().
Walter Roberson
2018년 6월 21일
When I check around, I find that it is signed values, not unsigned like you used. It needs to be demodulated though.
Quadrature signals are deliberately phase encoded, so you cannot use the information as a direction finder.
Ahmed Siddig
2018년 6월 21일
편집: Walter Roberson
2018년 6월 21일
OK sorry to ask but any idea how to deal with it in the same manner. For the record i added one of your codes above:
fid = fopen('ahm.bin','rb');
y = fread(fid,'uint8=>double');
fclose(fid)
y=mean(10.^(y(1:2:end) + 1i*y(2:2:end)))
compass(y);
actually it went well most of them started moving and some of them were right so that's a start how can i improve it thanks.
Walter Roberson
2018년 6월 21일
You need
y = fread(fid,'int8=>double');
I do not think the 10^ version is appropriate now that I have read more about the data. I consistently found people saying it was 8 bit signed complex data. As such, -128 is the minimum and 127 is the maximum, so my original thought that you could perhaps read them as degrees turned out to be incorrect.
With a sufficiently long signal you should be able to plot the quadrature constellations in order to determine how many states are being encoded.
The phase is manipulated deliberately as part of the signal, so you cannot use the phase information to locate direction -- at least not on a sample by sample basis.
Ahmed Siddig
2018년 6월 21일
Oh that's an issue i'll keep looking and notify you of any updates. thanks a lot Mr.Roberson
Ahmed Siddig
2018년 6월 21일
You know i tried the RTL-SDR with the original code and it was good most of them were right so i guess we'll just have for figure out a way to either convert the signed value to unsigned value or modify the code to deal with singed values.
Ahmed Siddig
2018년 6월 22일
Hi, so as i said using the RTL-SDR, the arrow started moving with every reading but i can't get it to point to the right position so how can i manipulate the reading to get it fixed? and if possible how to improve it? I attached some readings that i recorded E,N,W,S indicates the direction where i took the reading from. Thanks.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Phased Array Design and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)