이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Wireless channel modeling: Error using plot Specify the coordinates as vectors or matrices of the same size, or as a vector and a matrix that share the same length in at least
댓글 수: 16
Hi @Sylvester,
I executed code posted by you in the form above and it executed without errors. Please see attached.
After thoroughly going through attached pdf, I was able to implement code since you mentioned relevant to pertinent information provided in research document. Although it was not easy task and normally we try to focus on resolving problems posted in mathworks form posted by OPs. This type of work normally should be posted for freelance software programmers to help out with these kind of problems. However, if you are stuck with a problem in MATLAB, facing difficulties to resolve or need guidance then feel free to ask us for help and assistance, we will be more happy to help out.
So, going back to your request, I created a test script which is designed to calculate and visualize the Space Correlation Functions (CFs) and Doppler Power Spectral Densities (PSDs) for different scenarios in a communication system. First, I define constants.
f = 5.9e9; % Frequency in Hz
f_c_T_max = 570; % Maximum Doppler frequency in Hz
D = 300; % Distance between Tx and Rx in meters
a = 200; % Antenna spacing in meters
R = 40; % Radius in meters
Then, I defined two scenarios for testing: Scenario a representing isotropic environments with specific angles while Scenario b defines non-isotropic environments with different angles.
k_TR_a = 0; % Scenario a: isotropic environments
k_TR_b = 3; % Scenario b: non-isotropic environments
mu_TR_a = 0; % Scenario a: same direction
mu_TR_b = pi/4; % Scenario b: angle for TR
mu_EL_a = 3*pi/4; % Scenario a: angle for EL
mu_EL_b = 3*pi/4; % Scenario b: angle for EL
Then, I defined space correlation function (This function calculates the Space Correlation Function (CF) based on the model parameters. It uses the exponential decay model influenced by the parameters k, mu, R, and D) and Doppler power spectral density functions (This function computes the normalized Doppler PSD using the provided frequency and distance parameters).
function CF = calculateSpaceCFs(k, mu, R, D)
CF = exp(-k * (D/R) * (1 - cos(mu)));
end
function PSD = calculateDopplerPSD(f, f_c_T_max, D, a)
PSD = (f_c_T_max / (f * D)) * exp(-f_c_T_max / (f * a));
end
Then, I calculates the Space CFs for both scenarios (single-bounce and double-bounce) using the defined functions and used assertions to make sure that the calculated CF values are within valid bounds (0 to 1).
CF_SB_a = calculateSpaceCFs(k_TR_a, mu_TR_a, R, D);
CF_DB_a = calculateSpaceCFs(k_TR_a, mu_EL_a, R, D);
CF_SB_b = calculateSpaceCFs(k_TR_b, mu_TR_b, R, D);
CF_DB_b = calculateSpaceCFs(k_TR_b, mu_EL_b, R, D);
assert(CF_SB_a >= 0 && CF_SB_a <= 1, 'CF_SB_a is out of bounds');
assert(CF_DB_a >= 0 && CF_DB_a <= 1, 'CF_DB_a is out of bounds');
assert(CF_SB_b >= 0 && CF_SB_b <= 1, 'CF_SB_b is out of bounds');
assert(CF_DB_b >= 0 && CF_DB_b <= 1, 'CF_DB_b is out of bounds');
Afterwards, performed calculation for Doppler PSDs for both scenarios mentioned above and used assertions for PSDs as well which is similar to CFs.
PSD_a = calculateDopplerPSD(f, f_c_T_max, D, a);
PSD_b = calculateDopplerPSD(f, f_c_T_max, D, a);
assert(PSD_a >= 0, 'PSD_a is negative');
assert(PSD_b >= 0, 'PSD_b is negative');
Finally, the results for Space CFs and Doppler PSDs are printed to the command window for review along with
fprintf('Space CFs for Scenario a: Single-Bounce = %.4f, Double-Bounce =
%.4f\n', CF_SB_a, CF_DB_a);
fprintf('Space CFs for Scenario b: Single-Bounce = %.4f, Double-Bounce =
%.4f\n', CF_SB_b, CF_DB_b);
fprintf('Doppler PSDs: Scenario a = %.4f, Scenario b = %.4f\n', PSD_a, PSD_b);
The results for Space CFs and Doppler PSDs are printed to the command window for review along with plots generated for Space CFs for both scenarios and Doppler PSDs for both scenarios, allowing for a comparative analysis of the spectral densities.
figure;
hold on;
x_space = linspace(0, D, 100);
y_SB_a = calculateSpaceCFs(k_TR_a, mu_TR_a, R, x_space);
y_DB_a = calculateSpaceCFs(k_TR_a, mu_EL_a, R, x_space);
y_SB_b = calculateSpaceCFs(k_TR_b, mu_TR_b, R, x_space);
y_DB_b = calculateSpaceCFs(k_TR_b, mu_EL_b, R, x_space);
plot(x_space, y_SB_a, 'b', 'DisplayName', 'Single-Bounce Scenario a');
plot(x_space, y_DB_a, 'r', 'DisplayName', 'Double-Bounce Scenario a');
plot(x_space, y_SB_b, 'g', 'DisplayName', 'Single-Bounce Scenario b');
plot(x_space, y_DB_b, 'm', 'DisplayName', 'Double-Bounce Scenario b');
xlabel('Distance (m)');
ylabel('Space Correlation Function');
title('Space CFs for Different Scenarios');
legend show;
grid on;
hold off;
figure;
hold on;
x_doppler = linspace(0, f_c_T_max, 100);
y_PSD_a = calculateDopplerPSD(f, f_c_T_max, D, a);
y_PSD_b = calculateDopplerPSD(f, f_c_T_max, D, a);
plot(x_doppler, y_PSD_a * ones(size(x_doppler)), 'b', 'DisplayName', 'Doppler
PSD Scenario a');
plot(x_doppler, y_PSD_b * ones(size(x_doppler)), 'r', 'DisplayName', 'Doppler
PSD Scenario b');
xlabel('Frequency (Hz)');
ylabel('Normalized Doppler PSD');
title('Normalized Doppler PSDs for Different Scenarios');
legend show;
grid on;
hold off;
Please see attached plots.
Hope, this helps.
답변 (0개)
참고 항목
카테고리
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)