ploting a function handle

8 ビュー (過去 30 日間)
Ca Mai
Ca Mai 2020 年 7 月 10 日
コメント済み: Ca Mai 2020 年 7 月 10 日
can someone help me out please. I'm trying to plot this code but it gives me some errors ı don't know how to solve. It's my first time to use handle function.
close all;
clear variables;
clc;
f =1:0.1:28;
SF=4.0;
d0=1;
c = 3e8;
h_BS = 15;
TRDistance= 20;
h_BS = 15;
TRDistance= 20;
TXPower=30;
lambda = @(f) (c/(f*1e9));
PL_dB = @(f)(20*log(4*pi*d0*f*1e9/c) + 23.1*(1-0.03*((h_BS-35)/35))*log((TRDistance)) + SF*randn);
Pr_dBm =@(f)( TXPower - PL_dB);
figure;
plot(f, Pr_dBm(f));
xlabel('f');
ylabel('Pr_dBm');

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 10 日
編集済み: madhan ravi 2020 年 7 月 10 日
SF=4.0;
d0=1;
c = 3e8;
h_BS = 15;
TRDistance= 20;
TXPower=30;
lambda = @(f) (c/(f*1e9));
PL_dB = @(f)(20*log(4*pi*d0*f*1e9/c) + 23.1*(1-0.03*((h_BS-35)/35))*log((TRDistance)) + SF*randn);
Pr_dBm =@(f) TXPower - PL_dB(f);
figure(1)
fplot(Pr_dBm, [1,28])
xlabel('f')
ylabel('Pr_dBm')
  1 件のコメント
Ca Mai
Ca Mai 2020 年 7 月 10 日
Thank you very much. it works

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

その他の回答 (1 件)

Arthur Roué
Arthur Roué 2020 年 7 月 10 日
You are trying to subtract a variable with a function handle
Pr_dBm =@(f)( TXPower - PL_dB);
You should evaluate the function. This might work
Pr_dBm =@(f)( TXPower - PL_dB(f));
  1 件のコメント
Ca Mai
Ca Mai 2020 年 7 月 10 日
thanks alot. it works

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

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

製品


リリース

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by