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

5 views (last 30 days)
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;

Answers (1)

KSSV
KSSV on 28 Mar 2023
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;

Categories

Find more on Measurements and Feature Extraction in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!