finding coordinates from a plot
古いコメントを表示
Hi there,
I have plotted some data. I can use the "Data Cursor" to get the coordinates...but its becoming tedious.. I would like know if I can use some other way to get values of my graph for y= 10^(-9) or like this. .. I think the attached jpeg file clearly states my query.
Your help is highly appreciated.

the code goes like this :
for i=1:m;
for j=1:n;
snr(j)=p(j)/N(j);
ber(j)=.5*erfc((snr(j).^.5)/(2.828));
end
semilogy(pin_dbm,ber);
ylabel('BER');xlabel('Input Power, pin(dbm)');
title('BER vs Input Power Varying Number of Hops');
grid on
hold on
end
I have tried interp1 and find functions , but could not get any success!
Thanks
回答 (2 件)
KALYAN ACHARJYA
2019 年 3 月 1 日
編集済み: KALYAN ACHARJYA
2019 年 3 月 1 日
For each plot you can do that, do that after the input power statemnet, if in loop you can get it easily
idy=find(BER==10^(-9));
x_finding=x(idy); % x represents input power
Please note that in BER array there must be 10^(-9) value, otherwise you have to calculate it using interpolation.
1 件のコメント
Guillaume
2019 年 3 月 1 日
find is a waste of time here.
idy = BER == 10e-9;
x_finding = x(idy);
will work just as well. Or most likely, just as badly. As noted, 10e-9 must be present exactly in the array which is highly unlikely.
Guillaume
2019 年 3 月 1 日
0 投票
Note that your loops are not needed. You could calculate all the values at once, and plot that. Even if you use a loop, repeating the ylabel, xlabel, title, and grid at each step is a waste of time. Just do it once after the loop.
In your loop, nothing depends on i, so you're drawing m times the exact same plot. That's certainly not the code you've used to plot the above. Presumably, you've simplified it but removed too much.
Assuming, 10e-9 is not found exactly in your ber array, you'll have to interpolate. That can be done easily all at once for all plots if you store the plotting data in a m x n array. To show you how to do that we need an actual working code.
2 件のコメント
smile chand
2019 年 3 月 2 日
編集済み: Guillaume
2019 年 3 月 4 日
Guillaume
2019 年 3 月 4 日
You've just repeated the code that you put in the question, which as stated is not correct. Nothing in your loop depends on i, so you'd be plotting length(Nh) times the exact same plot. The first step of getting what you want would be to build a 2D array length(Nh) x length(pind_dbm) but without seeing the depency on i, I can't tell you how to do that.
カテゴリ
ヘルプ センター および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!