using find function

6 ビュー (過去 30 日間)
Kugen Raj
Kugen Raj 2012 年 2 月 22 日
im having a problem to find the correct value that i desire. im trying to plot graph for beamwidth for uniform array. but, the problem is that when i use the find function to find the angles which has -3dB gain, there is an error. so, i rounded up the -3dB angles to make it easy to use the find function. then, the rounded is not accrurate and consist some undesired value. example: p=-3.0041 -3.2098 -3.2000. I rounded up the value and it makes the value to become p= -3 -3 -3. hence, it contains some undesired value and makes it complicate to plot the graph. can anyone help to overcome this problem.

回答 (2 件)

Grzegorz Knor
Grzegorz Knor 2012 年 2 月 22 日
If I understand you correctly, try to round your vector roughly this way:
round(p*100)/100
or use find something like that:
find(abs(p-3)<0.001)
  1 件のコメント
Kugen Raj
Kugen Raj 2012 年 2 月 23 日
hi grzegorz,
Thanks for your suggestion. I tried as your showed here. But, I still cannot overcome the problem.
Y=sum(y);
YY=abs(Y);
p=20*log10(YY/max(YY));%normalized power in dB.
P=nearest(p);
PP=find(abs(P-3)<0.0001);
if size(PP)==[1,0];
bw(count2)=0;
else
bw(count2)=PP(1,2)-PP(1,1);
end
I'm still finding if there is any other alternative way to overcome this issue.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2012 年 2 月 22 日

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by