現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)