x=0:5:40; plot(x,C1,'g','-','linewidth',2); xlabel('P[dB]'); ylabel('secerecy rate'); grid on; C1 also a set of values with length same of x

7 件のコメント

madhan ravi
madhan ravi 2018 年 8 月 29 日
Can you format your code by pressing the code button.
Adam
Adam 2018 年 8 月 29 日
If you get an error please paste in the full error message.
ragini k
ragini k 2018 年 8 月 29 日
Error using plot Invalid first data argument
Error in Euci (line 26) plot(x,C1,'g','-','linewidth',2);
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 29 日
Define C1?
ragini k
ragini k 2018 年 8 月 29 日
clc; clear all; rp=10; N=10^-6; idx=1; Is3=zeros(1,length([0:5:40])); for sp=0:5:40 sp_l=10^(sp/10); hsd=abs(randn(1,1)+i*randn(1,1)).^2; hsdd=hsd*((sp_l*80^-3)/N); hrd1=abs(randn(1,1)+i*randn(1,1)).^2; hrdd=hrd1*((rp*50^-3)/N); hrd2=abs(randn(1,1)+i*randn(1,1)).^2; hrddd=hrd2*((rp*30^-3)/N); hse=abs(randn(1,1)+i*randn(1,1)).^2; hse1=hse*((sp_l*100^-3)/N); hre=abs(randn(1,1)+i*randn(1,1)).^2; hre1=hre*((rp*70^-3)/N); hree=abs(randn(1,1)+i*randn(1,1)).^2; hre2=hree*((rp*50^-3)/N); C1(idx)=(1/2)*log2(1+hsdd+hrdd)-(1/2)*log2(1+hse1+hre1); C2(idx)=(1/2)*log2(1+hsdd+hrddd)-(1/2)*log2(1+hse1+hre2); idx=idx+1; end x=0:5:40; plot(x,C1,'g','-','linewidth',2); xlabel('P[dB]'); ylabel('secerecy rate'); grid on;
madhan ravi
madhan ravi 2018 年 8 月 29 日
編集済み: madhan ravi 2018 年 8 月 29 日
plot(x,C1,'-g','linewidth',2) you were using the line marker incorrectly. The rest of the codes were perfect.
ragini k
ragini k 2018 年 8 月 29 日
Thanks a lot

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

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 29 日
編集済み: KALYAN ACHARJYA 2018 年 8 月 29 日

0 投票

clc
clear all
close all;
rp=10;
N=10^-6;
idx=1;
Is3=zeros(1,length([0:5:40]));
for sp=0:5:40
sp_l=10^(sp/10);
hsd=abs(randn(1,1)+i*randn(1,1)).^2;
hsdd=hsd*((sp_l*80^-3)/N);
hrd1=abs(randn(1,1)+i*randn(1,1)).^2;
hrdd=hrd1*((rp*50^-3)/N);
hrd2=abs(randn(1,1)+i*randn(1,1)).^2;
hrddd=hrd2*((rp*30^-3)/N);
hse=abs(randn(1,1)+i*randn(1,1)).^2;
hse1=hse*((sp_l*100^-3)/N);
hre=abs(randn(1,1)+i*randn(1,1)).^2;
hre1=hre*((rp*70^-3)/N);
hree=abs(randn(1,1)+i*randn(1,1)).^2;
hre2=hree*((rp*50^-3)/N);
C1(idx)=(1/2)*log2(1+hsdd+hrdd)-(1/2)*log2(1+hse1+hre1);
C2(idx)=(1/2)*log2(1+hsdd+hrddd)-(1/2)*log2(1+hse1+hre2);
idx=idx+1;
end
x=0:5:40;
plot(x,C1,'g','linewidth',2);
xlabel('P[dB]'); ylabel('secerecy rate'); grid on;

3 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 29 日
plot(x,C1,'-.g*','linewidth',2);
ragini k
ragini k 2018 年 8 月 29 日
thanks
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 29 日

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

質問済み:

2018 年 8 月 29 日

編集済み:

2018 年 8 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by