how i can solve this problem? unrecognized function or variable to run my code

Actually i want to plot 5g free space propagation loss in different operating frequency. So i got the problem that i mentioned above when i tried to run the code.
here is my code.
% Define the operating frequencies in Hz
freqs = linspace(1e9, 6e9, 100); % 100 equally spaced frequencies between 1 GHz and 6 GHz
% Define the distance between the transmitter and receiver in meters
distance = 100;
% Define the speed of light in meters per second
c = 3e8;
% Calculate the free space propagation loss in decibels (dB)
L_fs = (lambda / (4 * pi * d)).^2;% Free space path loss in dB
% Plot the results
plot(freqs/1e9, fspl);
title('Total Free Space Signal Attenuation vs. Operating Frequency');
xlabel('Operating Frequency (GHz)');
ylabel('Total Free Space Signal Attenuation (dB)');
grid on;

回答 (1 件)

KSSV
KSSV 2023 年 3 月 28 日
I think this is what you need.
% Define the operating frequencies in Hz
freqs = linspace(1e9, 6e9, 100); % 100 equally spaced frequencies between 1 GHz and 6 GHz
% Define the distance between the transmitter and receiver in meters
distance = 100;
% Define the speed of light in meters per second
c = 3e8;
% Calculate the free space propagation loss in decibels (dB)
% L_fs = (lambda / (4 * pi * d)).^2;% Free space path loss in dB
L_fs = (freqs / (4 * pi * distance)).^2;% Free space path loss in dB
% Plot the results
plot(freqs/1e9, L_fs);
title('Total Free Space Signal Attenuation vs. Operating Frequency');
xlabel('Operating Frequency (GHz)');
ylabel('Total Free Space Signal Attenuation (dB)');
grid on;

カテゴリ

ヘルプ センター および File ExchangeMeasurements and Feature Extraction についてさらに検索

質問済み:

2023 年 3 月 28 日

回答済み:

2023 年 3 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by